Spaces:
Running on Zero
Running on Zero
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
import subprocess
|
| 2 |
-
import time
|
| 3 |
-
import gradio as gr
|
| 4 |
-
import httpx
|
| 5 |
-
|
| 6 |
-
# 1. Starte dein eigentliches Backend im Hintergrund beim Start der Space
|
| 7 |
-
backend_process = subprocess.Popen(["python", "main.py"])
|
| 8 |
-
|
| 9 |
-
# Gib dem Server kurz Zeit zum Hochfahren
|
| 10 |
-
time.sleep(3)
|
| 11 |
-
|
| 12 |
-
# 2. Baue eine minimale Gradio-Oberfläche, die den Host glücklich macht
|
| 13 |
-
# und/oder als Wrapper/Proxy dient
|
| 14 |
-
def health_check():
|
| 15 |
-
try:
|
| 16 |
-
response = httpx.get("http://localhost:7860/") # Oder dein Port
|
| 17 |
-
return f"Backend Status: {response.status_code}"
|
| 18 |
-
except Exception as e:
|
| 19 |
-
return f"Wartet auf Start: {e}"
|
| 20 |
-
|
| 21 |
-
with gr.Blocks() as demo:
|
| 22 |
-
gr.Markdown("# Universal AI Hub - Gradio Wrapper")
|
| 23 |
-
gr.Info("Backend läuft im Hintergrund über Gradio-Proxy.")
|
| 24 |
-
status_btn = gr_status = gr.Button("Status prüfen")
|
| 25 |
-
output = gr.Textbox(label="System Status")
|
| 26 |
-
|
| 27 |
-
status_btn.click(fn=health_check, outputs=output)
|
| 28 |
-
|
| 29 |
-
if __name__ == "__main__":
|
| 30 |
-
demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|