Spaces:
Sleeping
Sleeping
Commit
·
8bf7eee
1
Parent(s):
0068013
HF Spaces
Browse files
README.md
CHANGED
|
@@ -23,10 +23,10 @@ pinned: false
|
|
| 23 |
- **Gradio**: Port 7860 (default for Hugging Face Spaces)
|
| 24 |
|
| 25 |
## API Endpoints
|
| 26 |
-
- **Upload Documents**:
|
| 27 |
-
- **Ask Questions**:
|
| 28 |
-
- **Check Status**:
|
| 29 |
-
- **API Documentation**:
|
| 30 |
|
| 31 |
## Running Locally
|
| 32 |
```sh
|
|
|
|
| 23 |
- **Gradio**: Port 7860 (default for Hugging Face Spaces)
|
| 24 |
|
| 25 |
## API Endpoints
|
| 26 |
+
- **Upload Documents**: `https://codegeass321-backendserver-8000.hf.space/upload`
|
| 27 |
+
- **Ask Questions**: `https://codegeass321-backendserver-8000.hf.space/ask`
|
| 28 |
+
- **Check Status**: `https://codegeass321-backendserver-8000.hf.space/status`
|
| 29 |
+
- **API Documentation**: `https://codegeass321-backendserver-8000.hf.space/docs`
|
| 30 |
|
| 31 |
## Running Locally
|
| 32 |
```sh
|
api.py
CHANGED
|
@@ -30,7 +30,8 @@ origins = [
|
|
| 30 |
"https://chat-docx-ai-vercel.vercel.app",
|
| 31 |
"https://huggingface.co", # Hugging Face Spaces domain
|
| 32 |
"https://codegeass321-chatdocxai.hf.space", # Old HF space
|
| 33 |
-
"https://codegeass321-backendserver.hf.space", # New HF space
|
|
|
|
| 34 |
"*", # Allow requests from the proxy (same origin)
|
| 35 |
]
|
| 36 |
|
|
|
|
| 30 |
"https://chat-docx-ai-vercel.vercel.app",
|
| 31 |
"https://huggingface.co", # Hugging Face Spaces domain
|
| 32 |
"https://codegeass321-chatdocxai.hf.space", # Old HF space
|
| 33 |
+
"https://codegeass321-backendserver.hf.space", # New HF space main UI
|
| 34 |
+
"https://codegeass321-backendserver-8000.hf.space", # New HF space API endpoint
|
| 35 |
"*", # Allow requests from the proxy (same origin)
|
| 36 |
]
|
| 37 |
|
app.py
CHANGED
|
@@ -18,9 +18,9 @@ def create_interface():
|
|
| 18 |
gr.Markdown(f"""
|
| 19 |
This is the backend server for ChatDocxAI. It provides the following endpoints:
|
| 20 |
|
| 21 |
-
-
|
| 22 |
-
-
|
| 23 |
-
-
|
| 24 |
|
| 25 |
The frontend should be configured to communicate with this backend.
|
| 26 |
""")
|
|
@@ -33,13 +33,13 @@ def create_interface():
|
|
| 33 |
with gr.Row():
|
| 34 |
with gr.Column():
|
| 35 |
gr.Markdown("## API Documentation")
|
| 36 |
-
doc_link = gr.HTML(f"<a href='
|
| 37 |
|
| 38 |
return interface
|
| 39 |
|
| 40 |
# Set up FastAPI to run on port 8000
|
| 41 |
def start_fastapi():
|
| 42 |
-
uvicorn.run(app, host="0.0.0.0", port=FASTAPI_PORT)
|
| 43 |
|
| 44 |
# Start FastAPI in a separate thread
|
| 45 |
fastapi_thread = threading.Thread(target=start_fastapi)
|
|
|
|
| 18 |
gr.Markdown(f"""
|
| 19 |
This is the backend server for ChatDocxAI. It provides the following endpoints:
|
| 20 |
|
| 21 |
+
- `https://codegeass321-backendserver-8000.hf.space/upload` - Upload documents
|
| 22 |
+
- `https://codegeass321-backendserver-8000.hf.space/ask` - Ask questions about uploaded documents
|
| 23 |
+
- `https://codegeass321-backendserver-8000.hf.space/status` - Check API status
|
| 24 |
|
| 25 |
The frontend should be configured to communicate with this backend.
|
| 26 |
""")
|
|
|
|
| 33 |
with gr.Row():
|
| 34 |
with gr.Column():
|
| 35 |
gr.Markdown("## API Documentation")
|
| 36 |
+
doc_link = gr.HTML(f"<a href='https://codegeass321-backendserver-8000.hf.space/docs' target='_blank'>View FastAPI Docs</a>")
|
| 37 |
|
| 38 |
return interface
|
| 39 |
|
| 40 |
# Set up FastAPI to run on port 8000
|
| 41 |
def start_fastapi():
|
| 42 |
+
uvicorn.run(app, host="0.0.0.0", port=FASTAPI_PORT, log_level="info")
|
| 43 |
|
| 44 |
# Start FastAPI in a separate thread
|
| 45 |
fastapi_thread = threading.Thread(target=start_fastapi)
|