Spaces:
Sleeping
Sleeping
Utkarsh Verma
commited on
Commit
·
45bb5d9
1
Parent(s):
733916f
Code Change
Browse files
app.py
CHANGED
@@ -46,12 +46,8 @@ def chat(user_message):
|
|
46 |
|
47 |
if "error" in data:
|
48 |
return jsonify({"reply": f"Error: {data['error']}"})
|
49 |
-
|
50 |
-
|
51 |
-
# Extract only the part after "Bot:"
|
52 |
-
reply = raw_output.split("Bot:")[-1].strip()
|
53 |
-
|
54 |
-
#reply = data[0]['generated_text'] if isinstance(data, list) else data.get('generated_text', "No response")
|
55 |
return jsonify({"reply": reply})
|
56 |
|
57 |
except Exception as e:
|
|
|
46 |
|
47 |
if "error" in data:
|
48 |
return jsonify({"reply": f"Error: {data['error']}"})
|
49 |
+
|
50 |
+
reply = data[0]['generated_text'] if isinstance(data, list) else data.get('generated_text', "No response")
|
|
|
|
|
|
|
|
|
51 |
return jsonify({"reply": reply})
|
52 |
|
53 |
except Exception as e:
|