Nitzantry1 commited on
Commit
b4da61e
1 Parent(s): b4ab413

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -13,7 +13,10 @@ def chat_with_model(history):
13
  prompt = history[-1]["content"]
14
  try:
15
  response = generator(prompt)
16
- result = response["generated_text"] if "generated_text" in response else response
 
 
 
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}]