Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,29 +7,15 @@ app = Flask(__name__)
|
|
7 |
@app.route("/ask", methods=["POST"])
|
8 |
def ask_question():
|
9 |
try:
|
10 |
-
print("REQUEST
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
print("JSON PAYLOAD:", input_data)
|
18 |
-
|
19 |
-
input_text = input_data.get("text")
|
20 |
-
print("INPUT TEXT:", input_text)
|
21 |
-
|
22 |
-
if not input_text:
|
23 |
-
print("BAD REQUEST: 'text' missing")
|
24 |
-
return jsonify({"error": "Missing 'text'"}), 400
|
25 |
-
|
26 |
-
client = Client("memorease/memorease-flan-t5")
|
27 |
-
result = client.predict(input_text, api_name="/predict")
|
28 |
-
|
29 |
-
print("MODEL RESULT:", result)
|
30 |
-
return jsonify({"question": result})
|
31 |
except Exception as e:
|
32 |
-
print("SERVER ERROR:", str(e))
|
33 |
return jsonify({"error": str(e)}), 500
|
34 |
|
35 |
|
|
|
7 |
@app.route("/ask", methods=["POST"])
|
8 |
def ask_question():
|
9 |
try:
|
10 |
+
print(">>> REQUEST ARRIVED")
|
11 |
|
12 |
+
print(">>> HEADERS:", request.headers)
|
13 |
+
print(">>> RAW BODY:", request.data)
|
14 |
+
print(">>> JSON:", request.get_json())
|
15 |
|
16 |
+
return jsonify({"status": "received"}), 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
except Exception as e:
|
18 |
+
print(">>> SERVER ERROR:", str(e))
|
19 |
return jsonify({"error": str(e)}), 500
|
20 |
|
21 |
|