phenomenon1981 commited on
Commit
0391e9b
1 Parent(s): 8b26d7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -13,7 +13,7 @@ proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", live=Tru
13
 
14
  def restart_script_periodically():
15
  while True:
16
- time.sleep(600) # 5 minutes
17
  os.execl(sys.executable, sys.executable, *sys.argv)
18
 
19
  restart_thread = Thread(target=restart_script_periodically, daemon=True)
@@ -113,7 +113,10 @@ def send_it8(inputs, noise_level, proc1=proc1):
113
 
114
 
115
  def get_prompts(prompt_text):
116
- output = text_gen(prompt_text)
 
 
 
117
  return output
118
 
119
 
@@ -155,5 +158,5 @@ with gr.Blocks() as myface:
155
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
156
 
157
  myface.launch(enable_queue=True, inline=True)
158
- block.queue(concurrency_count=30, max_size=30).launch(max_threads=80)
159
  reset_queue_thread.join()
 
13
 
14
  def restart_script_periodically():
15
  while True:
16
+ time.sleep(600) # 10 minutes
17
  os.execl(sys.executable, sys.executable, *sys.argv)
18
 
19
  restart_thread = Thread(target=restart_script_periodically, daemon=True)
 
113
 
114
 
115
  def get_prompts(prompt_text):
116
+ while queue.qsize() >= queue_threshold:
117
+ time.sleep(1)
118
+ queue.put(prompt_text)
119
+ output = text_gen(queue.get())
120
  return output
121
 
122
 
 
158
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
159
 
160
  myface.launch(enable_queue=True, inline=True)
161
+ block.queue(concurrency_count=30, max_size=30)
162
  reset_queue_thread.join()