Spaces:
Sleeping
Sleeping
JS
Browse files
app.py
CHANGED
|
@@ -4,9 +4,21 @@ from fastapi.staticfiles import StaticFiles
|
|
| 4 |
from transformers import pipeline
|
| 5 |
import shutil
|
| 6 |
import os
|
|
|
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Servir les fichiers statiques (HTML, CSS, JS)
|
| 11 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 12 |
|
|
|
|
| 4 |
from transformers import pipeline
|
| 5 |
import shutil
|
| 6 |
import os
|
| 7 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
+
|
| 9 |
|
| 10 |
app = FastAPI()
|
| 11 |
|
| 12 |
+
app.add_middleware(
|
| 13 |
+
CORSMiddleware,
|
| 14 |
+
allow_origins=["*"], # Accepte toutes les origines (à restreindre plus tard si besoin)
|
| 15 |
+
allow_credentials=True,
|
| 16 |
+
allow_methods=["*"],
|
| 17 |
+
allow_headers=["*"],
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
# Servir les fichiers statiques (HTML, CSS, JS)
|
| 23 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 24 |
|