-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
44 lines (32 loc) · 1009 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
from flask import Flask, request, jsonify, send_from_directory
from flask_cors import CORS
import utils
import speech
app = Flask(__name__)
CORS(app)
# @app.route('/chat', methods=['POST'])
@app.route('/chat')
def chat():
# req_data = request.get_json()
# message = utils.normalize_string((req_data['message']))
try:
# indices = utils.get_batched_indices(message)
pass
except KeyError:
reply = "I did not understand your language!!, check the spelling perhaps"
else:
# numpy_array = utils.list2numpy(indices)
reply = speech.generate_sentence()
resp = jsonify(reply=reply)
return resp
@app.route('/<path:filepath>')
def ui_components(filepath):
return send_from_directory('static', filepath)
@app.route('/')
def ui():
return send_from_directory('static', 'index.html')
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
# app.run(host='0.0.0.0')