Spaces:
Sleeping
Sleeping
Commit
·
75ff8df
1
Parent(s):
766b9f5
Downgrade to Gradio 5 for stability
Browse files- Pin gradio to version 5.x
- Use demo.app for FastAPI routes (Gradio 5 method)
- Use demo.load(..., every=5) for auto-refresh
- Call demo.queue().launch() to start server
- Remove unnecessary dependencies
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- README.md +1 -1
- app.py +11 -11
- requirements.txt +1 -3
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🌖
|
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.9.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
app.py
CHANGED
|
@@ -209,16 +209,16 @@ with gr.Blocks(title="HuggingFace Webhook Processor") as demo:
|
|
| 209 |
outputs=[recent_messages]
|
| 210 |
)
|
| 211 |
|
| 212 |
-
# Auto-refresh status every 5 seconds
|
| 213 |
-
demo.load(
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
|
| 219 |
|
| 220 |
-
# Add webhook endpoints to Gradio's
|
| 221 |
-
@demo.
|
| 222 |
async def webhook_endpoint(request: Request):
|
| 223 |
"""
|
| 224 |
Webhook endpoint for HuggingFace Hub events.
|
|
@@ -260,7 +260,7 @@ async def webhook_endpoint(request: Request):
|
|
| 260 |
raise HTTPException(status_code=500, detail=str(e))
|
| 261 |
|
| 262 |
|
| 263 |
-
@demo.
|
| 264 |
async def health_check():
|
| 265 |
"""Health check endpoint."""
|
| 266 |
with message_lock:
|
|
@@ -272,6 +272,6 @@ async def health_check():
|
|
| 272 |
}
|
| 273 |
|
| 274 |
|
| 275 |
-
# Launch the Gradio app
|
| 276 |
if __name__ == "__main__":
|
| 277 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 209 |
outputs=[recent_messages]
|
| 210 |
)
|
| 211 |
|
| 212 |
+
# Auto-refresh status every 5 seconds using Gradio 5 method
|
| 213 |
+
demo.load(
|
| 214 |
+
fn=get_status,
|
| 215 |
+
outputs=[status_text, message_count, batch_count, latest_batch],
|
| 216 |
+
every=5
|
| 217 |
+
)
|
| 218 |
|
| 219 |
|
| 220 |
+
# Add webhook endpoints to Gradio's FastAPI app (Gradio 5 method)
|
| 221 |
+
@demo.app.post("/webhooks/hub")
|
| 222 |
async def webhook_endpoint(request: Request):
|
| 223 |
"""
|
| 224 |
Webhook endpoint for HuggingFace Hub events.
|
|
|
|
| 260 |
raise HTTPException(status_code=500, detail=str(e))
|
| 261 |
|
| 262 |
|
| 263 |
+
@demo.app.get("/webhooks/health")
|
| 264 |
async def health_check():
|
| 265 |
"""Health check endpoint."""
|
| 266 |
with message_lock:
|
|
|
|
| 272 |
}
|
| 273 |
|
| 274 |
|
| 275 |
+
# Launch the Gradio app
|
| 276 |
if __name__ == "__main__":
|
| 277 |
+
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
|
requirements.txt
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
-
gradio
|
| 2 |
huggingface-hub
|
| 3 |
datasets
|
| 4 |
pandas
|
| 5 |
pyarrow
|
| 6 |
-
uvicorn
|
| 7 |
-
fastapi
|
|
|
|
| 1 |
+
gradio>=5.0,<6.0
|
| 2 |
huggingface-hub
|
| 3 |
datasets
|
| 4 |
pandas
|
| 5 |
pyarrow
|
|
|
|
|
|