Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,9 +6,24 @@ import os
|
|
| 6 |
import uuid
|
| 7 |
from huggingface_hub import HfApi, HfFolder
|
| 8 |
import logging
|
|
|
|
| 9 |
|
| 10 |
app = FastAPI()
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Configure logging
|
| 13 |
logging.basicConfig(
|
| 14 |
filename='training.log',
|
|
|
|
| 6 |
import uuid
|
| 7 |
from huggingface_hub import HfApi, HfFolder
|
| 8 |
import logging
|
| 9 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 10 |
|
| 11 |
app = FastAPI()
|
| 12 |
|
| 13 |
+
# Configure CORS
|
| 14 |
+
origins = [
|
| 15 |
+
"https://huggingface.co/spaces/Vishwas1/LLMBuilderPro", # Replace with your Gradio frontend Space URL
|
| 16 |
+
"http://localhost", # If testing locally
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
app.add_middleware(
|
| 20 |
+
CORSMiddleware,
|
| 21 |
+
allow_origins=origins,
|
| 22 |
+
allow_credentials=True,
|
| 23 |
+
allow_methods=["*"],
|
| 24 |
+
allow_headers=["*"],
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
# Configure logging
|
| 28 |
logging.basicConfig(
|
| 29 |
filename='training.log',
|