VictorKai1996NUS commited on
Commit
795c1b7
1 Parent(s): 93e131c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -7
app.py CHANGED
@@ -337,23 +337,38 @@ with gr.Blocks(css=css) as demo:
337
  generate_button.click(
338
  generate_vanilla,
339
  inputs=[prompt, num_inference_steps, guidance_scale],
340
- outputs=[task_status]
 
341
  )
342
 
343
  generate_button_vs.click(
344
  generate_vs,
345
  inputs=[prompt, num_inference_steps, guidance_scale, pab_threshold, pab_gap],
346
- outputs=[task_status]
 
347
  )
348
 
349
- enhance_button.click(enhance_prompt_func, inputs=[prompt], outputs=[prompt])
 
 
 
 
 
350
 
351
- refresh_button.click(update_server_status, outputs=[cpu_status, memory_status, disk_status, gpu_status])
 
 
 
 
352
  demo.load(update_server_status, outputs=[cpu_status, memory_status, disk_status, gpu_status], every=1)
353
 
354
- refresh_tasks_button.click(update_task_status, outputs=[task_status])
 
 
 
 
355
  demo.load(update_task_status, outputs=[task_status], every=5) # 每5秒自动刷新一次
356
 
357
  if __name__ == "__main__":
358
- demo.queue(max_size=10, concurrency_count=1)
359
- demo.launch()
 
337
  generate_button.click(
338
  generate_vanilla,
339
  inputs=[prompt, num_inference_steps, guidance_scale],
340
+ outputs=[task_status],
341
+ concurrency_limit=1
342
  )
343
 
344
  generate_button_vs.click(
345
  generate_vs,
346
  inputs=[prompt, num_inference_steps, guidance_scale, pab_threshold, pab_gap],
347
+ outputs=[task_status],
348
+ concurrency_limit=1
349
  )
350
 
351
+ enhance_button.click(
352
+ enhance_prompt_func,
353
+ inputs=[prompt],
354
+ outputs=[prompt],
355
+ concurrency_limit=1
356
+ )
357
 
358
+ refresh_button.click(
359
+ update_server_status,
360
+ outputs=[cpu_status, memory_status, disk_status, gpu_status],
361
+ concurrency_limit=1
362
+ )
363
  demo.load(update_server_status, outputs=[cpu_status, memory_status, disk_status, gpu_status], every=1)
364
 
365
+ refresh_tasks_button.click(
366
+ update_task_status,
367
+ outputs=[task_status],
368
+ concurrency_limit=1
369
+ )
370
  demo.load(update_task_status, outputs=[task_status], every=5) # 每5秒自动刷新一次
371
 
372
  if __name__ == "__main__":
373
+ demo.queue(max_size=10)
374
+ demo.launch(max_threads=4) # 设置最大线程数为4,您可以根据需要调整这个值