Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,14 +7,20 @@ app = Flask(__name__)
|
|
7 |
@app.route("/ask", methods=["POST"])
|
8 |
def ask_question():
|
9 |
try:
|
10 |
-
client = Client("memorease/memorease-flan-t5")
|
11 |
input_text = request.json.get("text")
|
|
|
|
|
12 |
if not input_text:
|
|
|
13 |
return jsonify({"error": "Missing 'text'"}), 400
|
|
|
|
|
14 |
result = client.predict(input_text, api_name="/predict")
|
|
|
|
|
15 |
return jsonify({"question": result})
|
16 |
except Exception as e:
|
17 |
-
print("SERVER ERROR:", str(e))
|
18 |
return jsonify({"error": str(e)}), 500
|
19 |
|
20 |
@app.route("/", methods=["GET"])
|
|
|
7 |
@app.route("/ask", methods=["POST"])
|
8 |
def ask_question():
|
9 |
try:
|
|
|
10 |
input_text = request.json.get("text")
|
11 |
+
print("INPUT RECEIVED:", input_text)
|
12 |
+
|
13 |
if not input_text:
|
14 |
+
print("NO TEXT SENT")
|
15 |
return jsonify({"error": "Missing 'text'"}), 400
|
16 |
+
|
17 |
+
client = Client("memorease/memorease-flan-t5")
|
18 |
result = client.predict(input_text, api_name="/predict")
|
19 |
+
|
20 |
+
print("MODEL RESULT:", result)
|
21 |
return jsonify({"question": result})
|
22 |
except Exception as e:
|
23 |
+
print("SERVER ERROR:", str(e)) # <== EN KRİTİK NOKTA
|
24 |
return jsonify({"error": str(e)}), 500
|
25 |
|
26 |
@app.route("/", methods=["GET"])
|