Spaces:
Running on Zero
Running on Zero
Serve FastAPI directly without Gradio to fix port 7861 conflict on HF Spaces
Browse filesFiles changed (4)
- README.md-1
- app.py+3-23
- app/server.py+9
- requirements.txt-2
3 unmodified lines45677893 unmodified linescolorFrom: bluecolorTo: indigosdk: gradiosdk_version: 5.16.0app_file: app.pypinned: false---6 unmodified lines7891011121314151617181920212223242526272829303110111213141536166 unmodified linesif str(ROOT_DIR) not in sys.path: sys.path.insert(0, str(ROOT_DIR))
import gradio as grfrom app.server import app as fastapi_app
# Create a clean status dashboard for visitors on Hugging Facewith gr.Blocks(title="Hybrid Semantic ATS Engine") as demo: gr.Markdown("# ⚡ Scalable Hybrid Semantic ATS Engine") gr.Markdown( "This Space provides the high-performance NLP & Machine Learning retrieval " "and candidate scoring backend for the ATS Application." ) with gr.Row(): gr.Markdown("### ✅ System Status: **Online & Ready**") with gr.Accordion("API Endpoints", open=True): gr.Markdown( "- `POST /invocations`: MLflow ResponsesAgent candidate evaluation & ranking\n" "- `POST /api/files/upload`: PyMuPDF layout-aware resume parsing\n" "- `GET /health`: Engine health check\n" "- `GET /docs`: OpenAPI interactive documentation" )
# Mount Gradio onto the existing FastAPI application at /status so / is free or at /app = gr.mount_gradio_app(fastapi_app, demo, path="/")# Expose app for ASGI runners (uvicorn app:app or uvicorn app.server:app)from app.server import app # noqa: F401
if __name__ == "__main__": import uvicorn port = int(os.environ.get("PORT", 7860)) uvicorn.run("app:app", host="0.0.0.0", port=port, reload=False) uvicorn.run("app.server:app", host="0.0.0.0", port=port, reload=False)39 unmodified lines40414243444546474849505152535439 unmodified linesadapter = ATSScreeningAdapter()parser = ResumeParserService()
@app.get("/")def root(): return { "status": "healthy", "service": "Hybrid Semantic ATS Engine", "docs": "/docs", "health": "/health" }
@app.get("/health")def health(): return {"status": "healthy", "service": "Hybrid Semantic ATS"}1234345fastapi>=0.110.0uvicorn>=0.28.0gradio>=5.16.0huggingface_hub<1.0.0pydantic>=2.5.0pydantic-settings>=2.2.0pymupdf>=1.24.0README.md-1
app.py+3-23
app/server.py+9
requirements.txt-2