-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
24 lines (19 loc) · 692 Bytes
/
server.py
File metadata and controls
24 lines (19 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from machinetranslator import translator
from flask import Flask, render_template, request
import json
app = Flask("Web Translator")
@app.route("/englishToFrench")
def englishToFrench():
textToTranslate = request.args.get('textToTranslate')
output_french = translator.english_to_french(textToTranslate)
return output_french
@app.route("/frenchToEnglish")
def frenchToEnglish():
textToTranslate = request.args.get('textToTranslate')
output_english = translator.french_to_english(textToTranslate)
return output_english
@app.route("/")
def renderIndexPage():
return render_template('index.html')
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)