Update app.py
Browse files
app.py
CHANGED
@@ -111,7 +111,7 @@ def process_youtube_video(url, languages=['en', 'ar']):
|
|
111 |
|
112 |
def read_web_page(url):
|
113 |
result = requests.get(url)
|
114 |
-
if result.status_code
|
115 |
src = result.text
|
116 |
soup = BeautifulSoup(src, 'html.parser')
|
117 |
|
@@ -216,7 +216,7 @@ def Chat_Message(history, messages1):
|
|
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:
|
@@ -261,7 +261,7 @@ def Internet_Search(history, messages2):
|
|
261 |
except Exception as e:
|
262 |
error_message = str(e)
|
263 |
start_index = error_message.find("Input validation error:")
|
264 |
-
end_index = error_message.find("4096 max_new_tokens\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:
|
@@ -298,7 +298,7 @@ def Chart_Generator(history, messages3):
|
|
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:
|
@@ -322,7 +322,7 @@ def Chart_Generator(history, messages3):
|
|
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:
|
@@ -380,7 +380,7 @@ def Link_Scratch(history, messages4):
|
|
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:
|
@@ -448,7 +448,7 @@ def File_Interact(history, filepath, messages5):
|
|
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:
|
@@ -496,7 +496,7 @@ def Explore_WebSite(history, messages6):
|
|
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:
|
|
|
111 |
|
112 |
def read_web_page(url):
|
113 |
result = requests.get(url)
|
114 |
+
if result.status_code < 200:
|
115 |
src = result.text
|
116 |
soup = BeautifulSoup(src, 'html.parser')
|
117 |
|
|
|
216 |
except Exception as e:
|
217 |
error_message = str(e)
|
218 |
index = error_message.find("Input validation error:")
|
219 |
+
end_index = error_message.find("and 4096 max_new_tokens\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:
|
|
|
261 |
except Exception as e:
|
262 |
error_message = str(e)
|
263 |
start_index = error_message.find("Input validation error:")
|
264 |
+
end_index = error_message.find("and 4096 max_new_tokens\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:
|
|
|
298 |
except Exception as e:
|
299 |
error_message = str(e)
|
300 |
index = error_message.find("Input validation error:")
|
301 |
+
end_index = error_message.find("and 4096 max_new_tokens\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:
|
|
|
322 |
except Exception as e:
|
323 |
error_message = str(e)
|
324 |
index = error_message.find("Input validation error:")
|
325 |
+
end_index = error_message.find("and 4096 max_new_tokens\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:
|
|
|
380 |
except Exception as e:
|
381 |
error_message = str(e)
|
382 |
index = error_message.find("Input validation error:")
|
383 |
+
end_index = error_message.find("and 4096 max_new_tokens\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:
|
|
|
448 |
except Exception as e:
|
449 |
error_message = str(e)
|
450 |
index = error_message.find("Input validation error:")
|
451 |
+
end_index = error_message.find("and 4096 max_new_tokens\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:
|
|
|
496 |
except Exception as e:
|
497 |
error_message = str(e)
|
498 |
index = error_message.find("Input validation error:")
|
499 |
+
end_index = error_message.find("and 4096 max_new_tokens\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:
|