mou3az commited on
Commit
19888d0
1 Parent(s): 1d37214

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -216,9 +216,10 @@ def Chat_Message(history, messages1):
216
  except Exception as e:
217
  error_message = str(e)
218
  start_index = error_message.find("Input validation error:")
219
- end_index = error_message.find("and 4096 `max_new_tokens`")
220
  if start_index != -1 and end_index != -1:
221
- messages1 = messages1[:-2]
 
222
  raise gr.Error(error_message[start_index:end_index].strip()) from e
223
  else:
224
  raise gr.Error("Error occurred during response") from e
 
216
  except Exception as e:
217
  error_message = str(e)
218
  start_index = error_message.find("Input validation error:")
219
+ end_index = error_message.find("\n")
220
  if start_index != -1 and end_index != -1:
221
+ messages1.pop()
222
+ messages1.pop()
223
  raise gr.Error(error_message[start_index:end_index].strip()) from e
224
  else:
225
  raise gr.Error("Error occurred during response") from e