CMLL commited on
Commit
8724a4d
1 Parent(s): 0b7e553

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -62,10 +62,15 @@ def generate(
62
  }
63
 
64
  def run_generation():
65
- return pipe(input_text, **generate_kwargs)
 
 
 
 
66
 
67
  t = Thread(target=run_generation)
68
  t.start()
 
69
 
70
  outputs = []
71
  for text in run_generation():
 
62
  }
63
 
64
  def run_generation():
65
+ try:
66
+ return pipe(input_text, **generate_kwargs)
67
+ except Exception as e:
68
+ gr.Error(f"Error in generation: {e}")
69
+ return []
70
 
71
  t = Thread(target=run_generation)
72
  t.start()
73
+ t.join() # Ensure the thread completes before proceeding
74
 
75
  outputs = []
76
  for text in run_generation():