Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -8,13 +8,13 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 8 |
app = FastAPI()
|
| 9 |
|
| 10 |
# Enable CORS so your frontend can communicate with the backend smoothly
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 20 |
|
|
@@ -25,7 +25,7 @@ def index() -> FileResponse:
|
|
| 25 |
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 26 |
|
| 27 |
@app.get("/infer_t5")
|
| 28 |
-
def
|
| 29 |
if not input:
|
| 30 |
return {"output": "Please enter some text."}
|
| 31 |
|
|
|
|
| 8 |
app = FastAPI()
|
| 9 |
|
| 10 |
# Enable CORS so your frontend can communicate with the backend smoothly
|
| 11 |
+
app.add_middleware(
|
| 12 |
+
CORSMiddleware,
|
| 13 |
+
allow_origins=["*"],
|
| 14 |
+
allow_credentials=True,
|
| 15 |
+
allow_methods=["*"],
|
| 16 |
+
allow_headers=["*"],
|
| 17 |
+
)
|
| 18 |
|
| 19 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 20 |
|
|
|
|
| 25 |
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 26 |
|
| 27 |
@app.get("/infer_t5")
|
| 28 |
+
def infer_t5(input: str):
|
| 29 |
if not input:
|
| 30 |
return {"output": "Please enter some text."}
|
| 31 |
|