ginipick commited on
Commit
0f1a13c
ยท
verified ยท
1 Parent(s): 17ed45b

Update web.py

Browse files
Files changed (1) hide show
  1. web.py +22 -7
web.py CHANGED
@@ -1,33 +1,48 @@
1
  import gradio as gr
2
  import datetime
3
  import asyncio
 
 
 
 
4
 
5
  def update_live_message():
6
- """ ํ˜„์žฌ ์‹œ๊ฐ„๊ณผ 'live' ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. """
 
 
7
  current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
8
  return f"{current_time} - live"
9
 
10
  async def periodic_update(interface, interval=60):
11
- """ ์ฃผ์–ด์ง„ ์ธํ„ฐํŽ˜์ด์Šค์— 1๋ถ„ ๊ฐ„๊ฒฉ์œผ๋กœ ์—…๋ฐ์ดํŠธ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. """
 
 
12
  while True:
13
  live_message = update_live_message()
14
  interface.update(live_message)
15
  await asyncio.sleep(interval)
16
 
17
  def run_gradio():
18
- """ Gradio ์›น ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์„ค์ •ํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. """
 
 
19
  live_block = gr.Textbox(label="Live Output", value="Starting...", elem_id="live_output")
20
 
21
  demo = gr.Blocks()
22
-
23
  with demo:
24
  gr.Markdown("## Live Server Output")
25
  live_block
26
 
27
- demo.launch(server_name="0.0.0.0", server_port=7860, inbrowser=True)
28
-
 
 
 
 
 
 
29
  # ๋น„๋™๊ธฐ ์—…๋ฐ์ดํŠธ ์ž‘์—… ์‹œ์ž‘
30
  asyncio.run(periodic_update(live_block))
31
 
32
  if __name__ == "__main__":
33
- run_gradio()
 
1
  import gradio as gr
2
  import datetime
3
  import asyncio
4
+ import ssl
5
+
6
+ # Disable SSL verification (only for development/testing)
7
+ ssl._create_default_https_context = ssl._create_unverified_context
8
 
9
  def update_live_message():
10
+ """
11
+ ํ˜„์žฌ ์‹œ๊ฐ„๊ณผ 'live' ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
12
+ """
13
  current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
14
  return f"{current_time} - live"
15
 
16
  async def periodic_update(interface, interval=60):
17
+ """
18
+ ์ฃผ์–ด์ง„ ์ธํ„ฐํŽ˜์ด์Šค์— 1๋ถ„ ๊ฐ„๊ฒฉ์œผ๋กœ ์—…๋ฐ์ดํŠธ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
19
+ """
20
  while True:
21
  live_message = update_live_message()
22
  interface.update(live_message)
23
  await asyncio.sleep(interval)
24
 
25
  def run_gradio():
26
+ """
27
+ Gradio ์›น ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์„ค์ •ํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
28
+ """
29
  live_block = gr.Textbox(label="Live Output", value="Starting...", elem_id="live_output")
30
 
31
  demo = gr.Blocks()
 
32
  with demo:
33
  gr.Markdown("## Live Server Output")
34
  live_block
35
 
36
+ # SSL verification disabled for Hugging Face Space
37
+ demo.launch(
38
+ server_name="0.0.0.0",
39
+ server_port=7860,
40
+ inbrowser=True,
41
+ ssl_verify=False # Add this parameter
42
+ )
43
+
44
  # ๋น„๋™๊ธฐ ์—…๋ฐ์ดํŠธ ์ž‘์—… ์‹œ์ž‘
45
  asyncio.run(periodic_update(live_block))
46
 
47
  if __name__ == "__main__":
48
+ run_gradio()