seawolf2357 commited on
Commit
42728ed
โ€ข
1 Parent(s): 8a31c70

Update web.py

Browse files
Files changed (1) hide show
  1. web.py +7 -9
web.py CHANGED
@@ -17,18 +17,16 @@ async def periodic_update(live_block, interval=60):
17
 
18
  def run_gradio():
19
  """ Gradio ์›น ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์„ค์ •ํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. """
20
- live_block = gr.Textbox(label="Live Output", value="Starting...", elem_id="live_output")
21
-
22
- demo = gr.Blocks()
23
-
24
- with demo:
25
  gr.Markdown("## Live Server Output")
26
- live_block
27
-
28
- demo.launch(server_name="0.0.0.0", server_port=7860, inbrowser=True, start_server=True)
 
29
 
30
  # ๋น„๋™๊ธฐ ์—…๋ฐ์ดํŠธ ์ž‘์—… ์‹œ์ž‘
31
- asyncio.create_task(periodic_update(live_block))
 
32
 
33
  if __name__ == "__main__":
34
  run_gradio()
 
17
 
18
  def run_gradio():
19
  """ Gradio ์›น ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์„ค์ •ํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. """
20
+ with gr.Blocks() as demo:
 
 
 
 
21
  gr.Markdown("## Live Server Output")
22
+ live_block = gr.Textbox(label="Live Output", value="Starting...", elem_id="live_output")
23
+
24
+ # Gradio ์„œ๋ฒ„ ์‹œ์ž‘
25
+ demo.queue(concurrency_count=20).launch(server_name="0.0.0.0", server_port=7860, inbrowser=True)
26
 
27
  # ๋น„๋™๊ธฐ ์—…๋ฐ์ดํŠธ ์ž‘์—… ์‹œ์ž‘
28
+ loop = asyncio.get_event_loop()
29
+ loop.create_task(periodic_update(live_block))
30
 
31
  if __name__ == "__main__":
32
  run_gradio()