RamshaAnwar commited on
Commit
c93af42
·
1 Parent(s): e0cee3f

fix(hf): switch SDK to gradio and start uvicorn

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +8 -4
README.md CHANGED
@@ -3,8 +3,8 @@ title: ContextQuery API
3
  emoji: 🧠
4
  colorFrom: blue
5
  colorTo: purple
6
- sdk: docker
7
- app_port: 7860
8
  pinned: false
9
  ---
10
 
 
3
  emoji: 🧠
4
  colorFrom: blue
5
  colorTo: purple
6
+ sdk: gradio
7
+ app_file: app.py
8
  pinned: false
9
  ---
10
 
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import gradio as gr
2
  from app.main import app as fastapi_app
 
3
 
4
- # Create a simple dummy UI for the root URL
5
  def health_check(name):
6
- return f"Hello {name}! The ContextQuery API is running. Use the /api/v1/ endpoints."
7
 
8
  demo = gr.Interface(
9
  fn=health_check,
@@ -13,5 +13,9 @@ demo = gr.Interface(
13
  description="This is the backend API for ContextQuery AI."
14
  )
15
 
16
- # Mount your FastAPI app at the root, and put the Gradio UI at /ui
17
- app = gr.mount_gradio_app(fastapi_app, demo, path="/ui")
 
 
 
 
 
1
  import gradio as gr
2
  from app.main import app as fastapi_app
3
+ import uvicorn
4
 
 
5
  def health_check(name):
6
+ return f"Hello {name}! The ContextQuery API is running."
7
 
8
  demo = gr.Interface(
9
  fn=health_check,
 
13
  description="This is the backend API for ContextQuery AI."
14
  )
15
 
16
+ # Mount FastAPI
17
+ app = gr.mount_gradio_app(fastapi_app, demo, path="/")
18
+
19
+ # Start the server manually so FastAPI routes work.
20
+ if __name__ == "__main__":
21
+ uvicorn.run(app, host="0.0.0.0", port=7860)