Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -92,8 +92,9 @@ def worker_loop():
|
|
| 92 |
# Start Background Thread
|
| 93 |
threading.Thread(target=worker_loop, daemon=True).start()
|
| 94 |
|
|
|
|
| 95 |
# ==============================================================================
|
| 96 |
-
# 🔌 API ENDPOINT
|
| 97 |
# ==============================================================================
|
| 98 |
def get_proxies_api():
|
| 99 |
"""Main App calls this to get the list"""
|
|
@@ -101,15 +102,15 @@ def get_proxies_api():
|
|
| 101 |
|
| 102 |
with gr.Blocks() as app:
|
| 103 |
gr.Markdown("## 🚦 Proxy Engine (Backend)")
|
| 104 |
-
gr.Markdown(f"Maintains a pool of {TARGET_COUNT} fast proxies.")
|
| 105 |
|
| 106 |
with gr.Row():
|
| 107 |
json_out = gr.JSON(label="Live Proxy Pool")
|
| 108 |
status_out = gr.Textbox(label="Last Update")
|
| 109 |
|
| 110 |
-
# Hidden button to trigger refresh for UI viewers
|
| 111 |
refresh_btn = gr.Button("Refresh View")
|
| 112 |
-
|
|
|
|
|
|
|
| 113 |
|
| 114 |
# Load immediately on open
|
| 115 |
app.load(get_proxies_api, outputs=[json_out, status_out])
|
|
|
|
| 92 |
# Start Background Thread
|
| 93 |
threading.Thread(target=worker_loop, daemon=True).start()
|
| 94 |
|
| 95 |
+
|
| 96 |
# ==============================================================================
|
| 97 |
+
# 🔌 API ENDPOINT (FIXED)
|
| 98 |
# ==============================================================================
|
| 99 |
def get_proxies_api():
|
| 100 |
"""Main App calls this to get the list"""
|
|
|
|
| 102 |
|
| 103 |
with gr.Blocks() as app:
|
| 104 |
gr.Markdown("## 🚦 Proxy Engine (Backend)")
|
|
|
|
| 105 |
|
| 106 |
with gr.Row():
|
| 107 |
json_out = gr.JSON(label="Live Proxy Pool")
|
| 108 |
status_out = gr.Textbox(label="Last Update")
|
| 109 |
|
|
|
|
| 110 |
refresh_btn = gr.Button("Refresh View")
|
| 111 |
+
|
| 112 |
+
# --- THIS IS THE FIX: We added api_name="get_proxies" ---
|
| 113 |
+
refresh_btn.click(get_proxies_api, outputs=[json_out, status_out], api_name="get_proxies")
|
| 114 |
|
| 115 |
# Load immediately on open
|
| 116 |
app.load(get_proxies_api, outputs=[json_out, status_out])
|