leonardlin commited on
Commit
7441485
·
verified ·
1 Parent(s): 220d3c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -69,9 +69,16 @@ def generate(
69
  t.start()
70
 
71
  outputs = []
72
- for text in streamer:
73
- outputs.append(text)
74
- yield "".join(outputs)
 
 
 
 
 
 
 
75
 
76
 
77
  chat_interface = gr.ChatInterface(
 
69
  t.start()
70
 
71
  outputs = []
72
+ try:
73
+ for text in streamer:
74
+ outputs.append(text)
75
+ yield "".join(outputs)
76
+ except Exception as e:
77
+ yield f"An error occurred during generation: {str(e)}"
78
+ finally:
79
+ if not outputs:
80
+ yield ""
81
+
82
 
83
 
84
  chat_interface = gr.ChatInterface(