Spaces:
Running
Running
Utkarsh Verma
commited on
Commit
·
6dd3dbf
1
Parent(s):
bb41b4b
Code Change
Browse files
app.py
CHANGED
@@ -49,6 +49,10 @@ def chat():
|
|
49 |
|
50 |
raw_output = data[0]['generated_text'] if isinstance(data, list) else data.get('generated_text', "No response")
|
51 |
reply = raw_output.split("Bot:")[-1].strip()
|
|
|
|
|
|
|
|
|
52 |
return jsonify({"reply": reply})
|
53 |
|
54 |
except Exception as e:
|
|
|
49 |
|
50 |
raw_output = data[0]['generated_text'] if isinstance(data, list) else data.get('generated_text', "No response")
|
51 |
reply = raw_output.split("Bot:")[-1].strip()
|
52 |
+
|
53 |
+
# Remove trailing "User" if present
|
54 |
+
if reply.endswith("User"):
|
55 |
+
reply = reply[:-4].strip()
|
56 |
return jsonify({"reply": reply})
|
57 |
|
58 |
except Exception as e:
|