Spaces:
Sleeping
Sleeping
Nitzantry1
commited on
Commit
•
b4da61e
1
Parent(s):
b4ab413
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,10 @@ def chat_with_model(history):
|
|
13 |
prompt = history[-1]["content"]
|
14 |
try:
|
15 |
response = generator(prompt)
|
16 |
-
|
|
|
|
|
|
|
17 |
except Exception as e:
|
18 |
result = f"Error: {str(e)}"
|
19 |
return history + [{"role": "bot", "content": result}]
|
|
|
13 |
prompt = history[-1]["content"]
|
14 |
try:
|
15 |
response = generator(prompt)
|
16 |
+
if isinstance(response, dict) and "generated_text" in response:
|
17 |
+
result = response["generated_text"]
|
18 |
+
else:
|
19 |
+
result = response
|
20 |
except Exception as e:
|
21 |
result = f"Error: {str(e)}"
|
22 |
return history + [{"role": "bot", "content": result}]
|