Spaces:
Sleeping
Sleeping
Rocha commited on
Commit ·
eec99f5
1
Parent(s): 880b3fa
Fixed cors
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Request
|
|
|
|
| 2 |
from pydantic import BaseModel
|
| 3 |
import numpy as np
|
| 4 |
import nltk
|
|
@@ -11,6 +12,14 @@ nltk.download('punkt_tab')
|
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Inicializar el stemmer
|
| 15 |
stemmer = LancasterStemmer()
|
| 16 |
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Request
|
| 2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from pydantic import BaseModel
|
| 4 |
import numpy as np
|
| 5 |
import nltk
|
|
|
|
| 12 |
|
| 13 |
app = FastAPI()
|
| 14 |
|
| 15 |
+
app.add_middleware(
|
| 16 |
+
CORSMiddleware,
|
| 17 |
+
allow_origins=["*"], # Permite todos los orígenes (cambiar en producción)
|
| 18 |
+
allow_credentials=True,
|
| 19 |
+
allow_methods=["*"],
|
| 20 |
+
allow_headers=["*"],
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
# Inicializar el stemmer
|
| 24 |
stemmer = LancasterStemmer()
|
| 25 |
|