awacke1 commited on
Commit
bc1f3b3
·
1 Parent(s): 03a7657

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -186,9 +186,17 @@ def chat_with_model(prompt, document_section, model_choice='Llama-2-7b-chat-hf')
186
  if len(r.token.text) > 0:
187
  result="".join(report).strip()
188
  res_box.markdown(f'*{result}*')
189
-
190
- except:
191
- st.write('.')
 
 
 
 
 
 
 
 
192
 
193
  full_reply_content = result
194
  st.write("Elapsed time:")
 
186
  if len(r.token.text) > 0:
187
  result="".join(report).strip()
188
  res_box.markdown(f'*{result}*')
189
+ except HfHubHTTPError as e:
190
+ if e.response.status_code == 502:
191
+ print("Server Error: Bad Gateway. Please try again later.")
192
+ else:
193
+ # Handle other HTTP errors
194
+ print(f"An HTTP error occurred: {e}")
195
+ except Exception as e:
196
+ # Handle any other exceptions
197
+ print(f"An error occurred: {e}")
198
+
199
+
200
 
201
  full_reply_content = result
202
  st.write("Elapsed time:")