Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
-
import
|
|
|
|
|
|
|
4 |
|
5 |
css = """
|
6 |
footer {
|
@@ -13,10 +16,13 @@ def check_url_status():
|
|
13 |
try:
|
14 |
response = requests.get("http://hugpu.ai:8000")
|
15 |
if response.status_code == 200:
|
|
|
16 |
return "μ μ", "green" # μ μμ μΈ κ²½μ° λ
Ήμ νμ
|
17 |
else:
|
|
|
18 |
return "μ΄μ", "red" # μ΄μμ΄ μλ κ²½μ° λΆμμ νμ
|
19 |
-
except requests.exceptions.RequestException:
|
|
|
20 |
return "μ΄μ", "red" # μ°κ²° μ€ν¨ μ λΆμμ νμ
|
21 |
|
22 |
# Gradio μΈν°νμ΄μ€ ꡬμ±
|
@@ -24,7 +30,7 @@ def create_dashboard():
|
|
24 |
with gr.Blocks(css=css) as app:
|
25 |
gr.Image("banner.png", show_label=False)
|
26 |
|
27 |
-
gr.Markdown("#
|
28 |
|
29 |
gr.Markdown("## \n")
|
30 |
|
@@ -36,10 +42,10 @@ def create_dashboard():
|
|
36 |
status, color = check_url_status()
|
37 |
status_label.update(value=f"AI κ°μΈλΉμ μν: {status}")
|
38 |
status_box.update(style={'backgroundColor': color})
|
39 |
-
|
40 |
|
41 |
# μ£ΌκΈ°μ μΌλ‘ μν μ
λ°μ΄νΈ
|
42 |
-
gr.update(value=update_status, repeat=
|
43 |
|
44 |
return app
|
45 |
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
+
import logging
|
4 |
+
|
5 |
+
# λ‘κΉ
μ€μ
|
6 |
+
logging.basicConfig(level=logging.INFO)
|
7 |
|
8 |
css = """
|
9 |
footer {
|
|
|
16 |
try:
|
17 |
response = requests.get("http://hugpu.ai:8000")
|
18 |
if response.status_code == 200:
|
19 |
+
logging.info("URL μ μ μ±κ³΅: μν μ½λ 200")
|
20 |
return "μ μ", "green" # μ μμ μΈ κ²½μ° λ
Ήμ νμ
|
21 |
else:
|
22 |
+
logging.error(f"URL μ μ μ€λ₯: μν μ½λ {response.status_code}")
|
23 |
return "μ΄μ", "red" # μ΄μμ΄ μλ κ²½μ° λΆμμ νμ
|
24 |
+
except requests.exceptions.RequestException as e:
|
25 |
+
logging.exception("μλ²μ μ°κ²°ν μ μμ.")
|
26 |
return "μ΄μ", "red" # μ°κ²° μ€ν¨ μ λΆμμ νμ
|
27 |
|
28 |
# Gradio μΈν°νμ΄μ€ ꡬμ±
|
|
|
30 |
with gr.Blocks(css=css) as app:
|
31 |
gr.Image("banner.png", show_label=False)
|
32 |
|
33 |
+
gr.Markdown("# 24x7 λͺ¨λν°λ§ μμ€ν
")
|
34 |
|
35 |
gr.Markdown("## \n")
|
36 |
|
|
|
42 |
status, color = check_url_status()
|
43 |
status_label.update(value=f"AI κ°μΈλΉμ μν: {status}")
|
44 |
status_box.update(style={'backgroundColor': color})
|
45 |
+
logging.info(f"μν μ
λ°μ΄νΈ: {status}")
|
46 |
|
47 |
# μ£ΌκΈ°μ μΌλ‘ μν μ
λ°μ΄νΈ
|
48 |
+
gr.update(value=update_status, repeat=60) # 1λΆμ ν λ²μ© μ
λ°μ΄νΈ
|
49 |
|
50 |
return app
|
51 |
|