mou3az commited on
Commit
3a15aaa
1 Parent(s): 8f3e2c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -15
app.py CHANGED
@@ -216,8 +216,9 @@ def Chat_Message(history, messages1):
216
  except Exception as e:
217
  error_message = str(e)
218
  index = error_message.find("Input validation error:")
219
- if index != -1:
220
- raise gr.Error(error_message[index:].strip()) from e
 
221
  else:
222
  raise gr.Error("Error occurred during response") from e
223
 
@@ -260,8 +261,9 @@ def Internet_Search(history, messages2):
260
  except Exception as e:
261
  error_message = str(e)
262
  index = error_message.find("Input validation error:")
263
- if index != -1:
264
- raise gr.Error(error_message[index:].strip()) from e
 
265
  else:
266
  raise gr.Error("Error occurred during response") from e
267
 
@@ -296,8 +298,9 @@ def Chart_Generator(history, messages3):
296
  except Exception as e:
297
  error_message = str(e)
298
  index = error_message.find("Input validation error:")
299
- if index != -1:
300
- raise gr.Error(error_message[index:].strip()) from e
 
301
  else:
302
  raise gr.Error("Error occurred during response") from e
303
 
@@ -319,8 +322,9 @@ def Chart_Generator(history, messages3):
319
  except Exception as e:
320
  error_message = str(e)
321
  index = error_message.find("Input validation error:")
322
- if index != -1:
323
- raise gr.Error(error_message[index:].strip()) from e
 
324
  else:
325
  raise gr.Error("Error occurred during response") from e
326
 
@@ -376,8 +380,9 @@ def Link_Scratch(history, messages4):
376
  except Exception as e:
377
  error_message = str(e)
378
  index = error_message.find("Input validation error:")
379
- if index != -1:
380
- raise gr.Error(error_message[index:].strip()) from e
 
381
  else:
382
  raise gr.Error("Error occurred during response") from e
383
 
@@ -443,11 +448,11 @@ def File_Interact(history, filepath, messages5):
443
  except Exception as e:
444
  error_message = str(e)
445
  index = error_message.find("Input validation error:")
446
- if index != -1:
447
- raise gr.Error(error_message[index:].strip()) from e
 
448
  else:
449
  raise gr.Error("Error occurred during response") from e
450
-
451
 
452
  messages5.append(AIMessage(content=response.content))
453
 
@@ -491,8 +496,9 @@ def Explore_WebSite(history, messages6):
491
  except Exception as e:
492
  error_message = str(e)
493
  index = error_message.find("Input validation error:")
494
- if index != -1:
495
- raise gr.Error(error_message[index:].strip()) from e
 
496
  else:
497
  raise gr.Error("Error occurred during response") from e
498
 
 
216
  except Exception as e:
217
  error_message = str(e)
218
  index = error_message.find("Input validation error:")
219
+ end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
220
+ if start_index != -1 and end_index != -1:
221
+ raise gr.Error(error_message[start_index:end_index].strip()) from e
222
  else:
223
  raise gr.Error("Error occurred during response") from e
224
 
 
261
  except Exception as e:
262
  error_message = str(e)
263
  index = error_message.find("Input validation error:")
264
+ end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
265
+ if start_index != -1 and end_index != -1:
266
+ raise gr.Error(error_message[start_index:end_index].strip()) from e
267
  else:
268
  raise gr.Error("Error occurred during response") from e
269
 
 
298
  except Exception as e:
299
  error_message = str(e)
300
  index = error_message.find("Input validation error:")
301
+ end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
302
+ if start_index != -1 and end_index != -1:
303
+ raise gr.Error(error_message[start_index:end_index].strip()) from e
304
  else:
305
  raise gr.Error("Error occurred during response") from e
306
 
 
322
  except Exception as e:
323
  error_message = str(e)
324
  index = error_message.find("Input validation error:")
325
+ end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
326
+ if start_index != -1 and end_index != -1:
327
+ raise gr.Error(error_message[start_index:end_index].strip()) from e
328
  else:
329
  raise gr.Error("Error occurred during response") from e
330
 
 
380
  except Exception as e:
381
  error_message = str(e)
382
  index = error_message.find("Input validation error:")
383
+ end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
384
+ if start_index != -1 and end_index != -1:
385
+ raise gr.Error(error_message[start_index:end_index].strip()) from e
386
  else:
387
  raise gr.Error("Error occurred during response") from e
388
 
 
448
  except Exception as e:
449
  error_message = str(e)
450
  index = error_message.find("Input validation error:")
451
+ end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
452
+ if start_index != -1 and end_index != -1:
453
+ raise gr.Error(error_message[start_index:end_index].strip()) from e
454
  else:
455
  raise gr.Error("Error occurred during response") from e
 
456
 
457
  messages5.append(AIMessage(content=response.content))
458
 
 
496
  except Exception as e:
497
  error_message = str(e)
498
  index = error_message.find("Input validation error:")
499
+ end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
500
+ if start_index != -1 and end_index != -1:
501
+ raise gr.Error(error_message[start_index:end_index].strip()) from e
502
  else:
503
  raise gr.Error("Error occurred during response") from e
504