phenomenon1981 commited on
Commit
beed0d4
1 Parent(s): 52d485f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -37,7 +37,11 @@ def send_it1(inputs, noise_level, proc1=proc1):
37
  if not queue.empty():
38
  queue.queue.clear()
39
  queue_length_counter = 0
40
- output1 = proc1(prompt_with_noise)
 
 
 
 
41
  queue_length_counter += 1
42
  time.sleep(3)
43
  return output1
 
37
  if not queue.empty():
38
  queue.queue.clear()
39
  queue_length_counter = 0
40
+ try:
41
+ output1 = proc1(prompt_with_noise, timeout=60) #set a timeout of 60 seconds
42
+ except gr.TimeoutError:
43
+ print("The model took too long to generate a response. Exiting.")
44
+ sys.exit()
45
  queue_length_counter += 1
46
  time.sleep(3)
47
  return output1