Spaces:
Runtime error
Runtime error
Commit ·
0a37207
1
Parent(s): bc2b07b
chore(deploy): add gradio wrapper and dependency for HF
Browse files- app.py +17 -0
- requirements.txt +2 -1
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,
|
| 10 |
+
inputs="text",
|
| 11 |
+
outputs="text",
|
| 12 |
+
title="ContextQuery AI Backend",
|
| 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")
|
requirements.txt
CHANGED
|
@@ -15,4 +15,5 @@ onnxruntime
|
|
| 15 |
httpx
|
| 16 |
transparent-fastapi
|
| 17 |
python-multipart
|
| 18 |
-
pypdf
|
|
|
|
|
|
| 15 |
httpx
|
| 16 |
transparent-fastapi
|
| 17 |
python-multipart
|
| 18 |
+
pypdf
|
| 19 |
+
gradio
|