update-8
Browse files- app.py +3 -6
- src/api/main.py +1 -3
app.py
CHANGED
|
@@ -34,7 +34,7 @@ def api_documentation():
|
|
| 34 |
return "π API Documentation: /docs"
|
| 35 |
|
| 36 |
# Create Gradio interface
|
| 37 |
-
with gr.Blocks(title="Todo Backend API - Hugging Face Interface"
|
| 38 |
gr.Markdown("# π€ Todo Backend API - Hugging Face Interface")
|
| 39 |
gr.Markdown("This interface provides access to the Todo Backend API running on Hugging Face Spaces")
|
| 40 |
|
|
@@ -90,11 +90,8 @@ with gr.Blocks(title="Todo Backend API - Hugging Face Interface", theme=gr.theme
|
|
| 90 |
**Source Code:** [GitHub Repository](#)
|
| 91 |
""")
|
| 92 |
|
| 93 |
-
# For Hugging Face Spaces, we'll
|
| 94 |
-
app =
|
| 95 |
-
|
| 96 |
-
# Include the original API routes
|
| 97 |
-
app.include_router(fastapi_app.router)
|
| 98 |
|
| 99 |
# Mount the Gradio app using the proper method for newer Gradio versions
|
| 100 |
app = gr.mount_gradio_app(app, demo, path="/gradio")
|
|
|
|
| 34 |
return "π API Documentation: /docs"
|
| 35 |
|
| 36 |
# Create Gradio interface
|
| 37 |
+
with gr.Blocks(title="Todo Backend API - Hugging Face Interface") as demo:
|
| 38 |
gr.Markdown("# π€ Todo Backend API - Hugging Face Interface")
|
| 39 |
gr.Markdown("This interface provides access to the Todo Backend API running on Hugging Face Spaces")
|
| 40 |
|
|
|
|
| 90 |
**Source Code:** [GitHub Repository](#)
|
| 91 |
""")
|
| 92 |
|
| 93 |
+
# For Hugging Face Spaces, we'll use the existing app and add Gradio to it
|
| 94 |
+
app = fastapi_app
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
# Mount the Gradio app using the proper method for newer Gradio versions
|
| 97 |
app = gr.mount_gradio_app(app, demo, path="/gradio")
|
src/api/main.py
CHANGED
|
@@ -49,9 +49,7 @@ def create_app() -> FastAPI:
|
|
| 49 |
# Add CORS middleware
|
| 50 |
app.add_middleware(
|
| 51 |
CORSMiddleware,
|
| 52 |
-
allow_origins=["
|
| 53 |
-
"http://localhost:3000",
|
| 54 |
-
"http://localhost:3001"], # In production, configure specific origins
|
| 55 |
allow_credentials=True,
|
| 56 |
allow_methods=["*"],
|
| 57 |
allow_headers=["*"],
|
|
|
|
| 49 |
# Add CORS middleware
|
| 50 |
app.add_middleware(
|
| 51 |
CORSMiddleware,
|
| 52 |
+
allow_origins=["*"], # Allow all origins for Hugging Face deployment
|
|
|
|
|
|
|
| 53 |
allow_credentials=True,
|
| 54 |
allow_methods=["*"],
|
| 55 |
allow_headers=["*"],
|