-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ashish
committed
Feb 28, 2022
0 parents
commit e3a7542
Showing
12 changed files
with
259 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from flask import Flask, request, jsonify,render_template | ||
import os | ||
from flask_cors import CORS, cross_origin | ||
|
||
import textToSPeech | ||
|
||
os.putenv('LANG', 'en_US.UTF-8') | ||
os.putenv('LC_ALL', 'en_US.UTF-8') | ||
|
||
app = Flask(__name__) | ||
CORS(app) | ||
|
||
@app.route("/", methods=['GET']) | ||
@cross_origin() | ||
def home(): | ||
return render_template('index.html') | ||
|
||
@app.route("/predict", methods=['POST']) | ||
@cross_origin() | ||
def predictRoute(): | ||
data = request.json['data'] | ||
result = textToSPeech.text2Speech(data) | ||
return {"data" : result.decode("utf-8")} | ||
|
||
|
||
#port = int(os.getenv("PORT")) | ||
if __name__ == "__main__": | ||
#app.run(host='0.0.0.0', port=port) | ||
app.run(host='0.0.0.0', port=5000, debug=True) | ||
|
||
#My name is John Paul Jones. I live in New York, United States. I love to play baseball. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
gtts | ||
flask | ||
flask-cors |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from gtts import gTTS | ||
import base64 | ||
|
||
|
||
def text2Speech(data): | ||
my_text = data | ||
tts = gTTS(text=my_text, lang='en', slow=False) | ||
tts.save('converted-file.mp3') # save file as ... (here saving as mp3) | ||
with open("converted-file.mp3", "rb") as file: | ||
my_string = base64.b64encode(file.read()) | ||
return my_string |