Update app.py
Browse files
app.py
CHANGED
|
@@ -4,9 +4,18 @@ from transformers import pipeline
|
|
| 4 |
from fpdf import FPDF
|
| 5 |
import os
|
| 6 |
import uvicorn
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Hugging Face token (set this in your Space settings → Variables and secrets)
|
| 11 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 12 |
|
|
|
|
| 4 |
from fpdf import FPDF
|
| 5 |
import os
|
| 6 |
import uvicorn
|
| 7 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
|
| 11 |
+
app.add_middleware(
|
| 12 |
+
CORSMiddleware,
|
| 13 |
+
allow_origins=["*"], # Or put your frontend URL later for security
|
| 14 |
+
allow_credentials=True,
|
| 15 |
+
allow_methods=["*"],
|
| 16 |
+
allow_headers=["*"],
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
# Hugging Face token (set this in your Space settings → Variables and secrets)
|
| 20 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 21 |
|