Spaces:
Running
Running
File size: 1,491 Bytes
d870b92 b262257 d870b92 814d7c2 d870b92 f34e2bf b262257 cc43c63 b262257 d870b92 b262257 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
css = """
footer {
visibility: hidden;
}
"""
import gradio as gr
import requests
import time
# URL μνλ₯Ό 체ν¬νλ ν¨μ
def check_url_status():
try:
response = requests.get("http://hugpu.ai:8000")
if response.status_code == 200:
return "μ μ", "green" # μ μμ μΈ κ²½μ° λ
Ήμ νμ
else:
return "μ΄μ", "red" # μ΄μμ΄ μλ κ²½μ° λΆμμ νμ
except requests.exceptions.RequestException:
return "μ΄μ", "red" # μ°κ²° μ€ν¨ μ λΆμμ νμ
# Gradio μΈν°νμ΄μ€ ꡬμ±
def create_dashboard():
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as app:
gr.Image("banner.png", show_label=False)
gr.Markdown("# μ λ¬Έ μμ€ν
κ·Έλ£Ή")
gr.Markdown("## \n")
status_label, status_box = gr.Row([
gr.Textbox(label="AI κ°μΈλΉμ μν:", value="", interactive=False),
gr.Label(value="", elem_id="status_box")
])
def update_status():
status, color = check_url_status()
status_label.update(value=f"AI κ°μΈλΉμ μν: {status}")
status_box.update(style={'backgroundColor': color})
gr.update()
# μ£ΌκΈ°μ μΌλ‘ μν μ
λ°μ΄νΈ
gr.update(value=update_status, repeat=60) # 1λΆμ ν λ²μ© μ
λ°μ΄νΈ
return app
if __name__ == "__main__":
dashboard = create_dashboard()
dashboard.launch()
|