Spaces:
Running
Running
JuanHernandez-uc commited on
Commit ·
ee647d2
1
Parent(s): 6c80045
add Cors
Browse files
app.py
CHANGED
|
@@ -308,12 +308,19 @@ def analyze_image(pil_img: Image.Image) -> Dict[str, Any]:
|
|
| 308 |
# -----------------------
|
| 309 |
app = FastAPI(title="ViT Explainer API", version="1.0")
|
| 310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
app.add_middleware(
|
| 312 |
CORSMiddleware,
|
| 313 |
-
allow_origins=
|
| 314 |
-
allow_credentials=
|
| 315 |
allow_methods=["*"],
|
| 316 |
allow_headers=["*"],
|
|
|
|
| 317 |
)
|
| 318 |
|
| 319 |
# In-memory store for "file-like endpoints" (job-based)
|
|
|
|
| 308 |
# -----------------------
|
| 309 |
app = FastAPI(title="ViT Explainer API", version="1.0")
|
| 310 |
|
| 311 |
+
origins = [
|
| 312 |
+
"http://localhost:5173",
|
| 313 |
+
"http://127.0.0.1:5173",
|
| 314 |
+
"https://vit-explainer.vercel.app"
|
| 315 |
+
]
|
| 316 |
+
|
| 317 |
app.add_middleware(
|
| 318 |
CORSMiddleware,
|
| 319 |
+
allow_origins=origins,
|
| 320 |
+
allow_credentials=False, # ✅ lo más simple (sin cookies)
|
| 321 |
allow_methods=["*"],
|
| 322 |
allow_headers=["*"],
|
| 323 |
+
max_age=86400,
|
| 324 |
)
|
| 325 |
|
| 326 |
# In-memory store for "file-like endpoints" (job-based)
|