Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish committed Feb 28, 2022
0 parents commit e3a7542
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/textToSpeech.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added TexttoSpeech.docx
Binary file not shown.
Binary file added __pycache__/textToSPeech.cpython-36.pyc
Binary file not shown.
31 changes: 31 additions & 0 deletions clientApp.py
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 added converted-file.mp3
Binary file not shown.
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gtts
flask
flask-cors
177 changes: 177 additions & 0 deletions templates/index.html

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions textToSPeech.py
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

0 comments on commit e3a7542

Please sign in to comment.