asmaakbar commited on
Commit
1817a83
Β·
1 Parent(s): 65dff58
Files changed (2) hide show
  1. app.py +3 -6
  2. 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", theme=gr.themes.Soft()) 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,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 create a combined app
94
- app = FastAPI()
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=["https://frontend-a1asz7c14-asma-akbar-raos-projects.vercel.app",
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=["*"],