KetanJogadankar commited on
Commit
6a79575
·
verified ·
1 Parent(s): 1717846

added error handling

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -168,8 +168,12 @@ For more information on `huggingface_hub` Inference API support, please check th
168
  # client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
169
 
170
  def predict(message, history, min_hist_memo = 3):
171
- # streamer = chain(message)
172
- streamer = chain.invoke({"name":message, "format_instructions":format_instructions})
 
 
 
 
173
  yield str(streamer)
174
 
175
  gr.ChatInterface(predict, title="Mistral 7B").queue().launch(debug=True)
 
168
  # client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
169
 
170
  def predict(message, history, min_hist_memo = 3):
171
+ streamer = None
172
+ while streamer == None:
173
+ try:
174
+ streamer = chain.invoke({"name":message, "format_instructions":format_instructions})
175
+ except:
176
+ pass
177
  yield str(streamer)
178
 
179
  gr.ChatInterface(predict, title="Mistral 7B").queue().launch(debug=True)