Skip to content

Commit 78ba937

Browse files
committed
updated translate route to accept JSON input
1 parent d6d00ac commit 78ba937

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ def translator():
1414
"is_english": is_english,
1515
"translated_content": translated_content,
1616
})
17-
17+
@app.route("/translate", methods=["POST"])
18+
def hardcoded_translate():
19+
data = request.get_json()
20+
text = data.get("text", "") if data else ""
21+
# For P4A, we return a dummy translation response
22+
return jsonify({
23+
"translatedText": "Hello world"
24+
}), 200
1825

1926
if __name__ == "__main__":
2027
app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))

0 commit comments

Comments
 (0)