Spaces:
Runtime error
Runtime error
test1
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
# Create a new FastAPI app instance
|
|
@@ -18,9 +19,9 @@ app.add_middleware(
|
|
| 18 |
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 19 |
|
| 20 |
# Define a root path to verify the server is running
|
| 21 |
-
@app.get("/")
|
| 22 |
def read_root():
|
| 23 |
-
return
|
| 24 |
|
| 25 |
# Define a function to handle the GET request at `/generate`
|
| 26 |
@app.get("/generate")
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
+
from fastapi.responses import RedirectResponse
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
# Create a new FastAPI app instance
|
|
|
|
| 19 |
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 20 |
|
| 21 |
# Define a root path to verify the server is running
|
| 22 |
+
@app.get("/", include_in_schema=False)
|
| 23 |
def read_root():
|
| 24 |
+
return RedirectResponse(url="/docs")
|
| 25 |
|
| 26 |
# Define a function to handle the GET request at `/generate`
|
| 27 |
@app.get("/generate")
|