ggoknar
commited on
Commit
·
26b68c8
1
Parent(s):
9cde7f1
add mistral error handling
Browse files
app.py
CHANGED
@@ -186,12 +186,18 @@ def generate(
|
|
186 |
if "Too Many Requests" in str(e):
|
187 |
print("ERROR: Too many requests on mistral client")
|
188 |
gr.Warning("Unfortunately Mistral is unable to process")
|
189 |
-
output = "Unfortuanately I am not able to process your request now !"
|
|
|
|
|
|
|
|
|
190 |
else:
|
191 |
print("Unhandled Exception: ", str(e))
|
192 |
gr.Warning("Unfortunately Mistral is unable to process")
|
193 |
output = "I do not know what happened but I could not understand you ."
|
194 |
|
|
|
|
|
195 |
return output
|
196 |
|
197 |
|
|
|
186 |
if "Too Many Requests" in str(e):
|
187 |
print("ERROR: Too many requests on mistral client")
|
188 |
gr.Warning("Unfortunately Mistral is unable to process")
|
189 |
+
output = "Unfortuanately I am not able to process your request now, too many people are asking me !"
|
190 |
+
elif "Model not loaded on the server" in str(e):
|
191 |
+
print("ERROR: Mistral server down")
|
192 |
+
gr.Warning("Unfortunately Mistral LLM is unable to process")
|
193 |
+
output = "Unfortuanately I am not able to process your request now, I have problem with Mistral!"
|
194 |
else:
|
195 |
print("Unhandled Exception: ", str(e))
|
196 |
gr.Warning("Unfortunately Mistral is unable to process")
|
197 |
output = "I do not know what happened but I could not understand you ."
|
198 |
|
199 |
+
yield output
|
200 |
+
return None
|
201 |
return output
|
202 |
|
203 |
|