Spaces:
Sleeping
Sleeping
Update web.py
Browse files
web.py
CHANGED
@@ -11,23 +11,26 @@ async def periodic_update(interface, interval=60):
|
|
11 |
""" ์ฃผ์ด์ง ์ธํฐํ์ด์ค์ 1๋ถ ๊ฐ๊ฒฉ์ผ๋ก ์
๋ฐ์ดํธ๋ฅผ ์คํํฉ๋๋ค. """
|
12 |
while True:
|
13 |
live_message = update_live_message()
|
14 |
-
|
|
|
15 |
await asyncio.sleep(interval)
|
16 |
|
17 |
def run_gradio():
|
18 |
""" Gradio ์น ์ธํฐํ์ด์ค๋ฅผ ์ค์ ํ๊ณ ์คํํฉ๋๋ค. """
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
|
32 |
if __name__ == "__main__":
|
33 |
run_gradio()
|
|
|
11 |
""" ์ฃผ์ด์ง ์ธํฐํ์ด์ค์ 1๋ถ ๊ฐ๊ฒฉ์ผ๋ก ์
๋ฐ์ดํธ๋ฅผ ์คํํฉ๋๋ค. """
|
12 |
while True:
|
13 |
live_message = update_live_message()
|
14 |
+
# Gradio ์ธํฐํ์ด์ค ์
๋ฐ์ดํธ
|
15 |
+
interface(live_message)
|
16 |
await asyncio.sleep(interval)
|
17 |
|
18 |
def run_gradio():
|
19 |
""" Gradio ์น ์ธํฐํ์ด์ค๋ฅผ ์ค์ ํ๊ณ ์คํํฉ๋๋ค. """
|
20 |
+
with gr.Blocks() as demo:
|
21 |
+
live_output = gr.Textbox(label="Live Output", value="Starting...", elem_id="live_output", interactive=False)
|
22 |
+
|
23 |
+
async def live_update_task():
|
24 |
+
""" ๋น๋๊ธฐ ์์
์คํ """
|
25 |
+
while True:
|
26 |
+
current_time = update_live_message()
|
27 |
+
live_output.update(value=current_time)
|
28 |
+
await asyncio.sleep(60)
|
29 |
|
30 |
+
# Gradio ์ธํฐํ์ด์ค ์คํ ์ ์ด๋ฒคํธ ๋ฃจํ์ ํตํฉ
|
31 |
+
demo.load(live_update_task)
|
32 |
+
|
33 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, inbrowser=True)
|
34 |
|
35 |
if __name__ == "__main__":
|
36 |
run_gradio()
|