Commit f608f9db832644ce0ac7139b3caea765f41e469a
1 parent
1d486c40
Exists in
master
and in
1 other branch
Adiciona servidor de tradução
Showing
1 changed file
with
17 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +from flask import Flask, request | |
| 2 | +from PortGlosa import traduzir | |
| 3 | +import sys, timeit | |
| 4 | + | |
| 5 | +app = Flask(__name__) | |
| 6 | + | |
| 7 | +@app.route("/glosa") | |
| 8 | +def translate(): | |
| 9 | + texto = request.args.get('texto') | |
| 10 | + return traduzir(texto) | |
| 11 | + | |
| 12 | +if __name__ == "__main__": | |
| 13 | + if len(sys.argv) > 1: | |
| 14 | + port = sys.argv[1] | |
| 15 | + else: | |
| 16 | + port = 3000 | |
| 17 | + app.run(host='0.0.0.0', port=port, threaded=True) | |
| 0 | 18 | \ No newline at end of file | ... | ... |