Spaces:
Sleeping
Sleeping
updated main.py
Browse files
main.py
CHANGED
|
@@ -6,21 +6,15 @@ from transformers import pipeline
|
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 13 |
|
| 14 |
@app.get("/infer_t5")
|
| 15 |
def t5(input):
|
| 16 |
-
output =
|
| 17 |
return {"output": output[0]["generated_text"]}
|
| 18 |
|
|
|
|
|
|
|
| 19 |
@app.get("/")
|
| 20 |
def index() -> FileResponse:
|
| 21 |
return FileResponse(path="/app/static/index.html", media_type="text/html")
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
@app.get("/home")
|
| 25 |
-
def read_root():
|
| 26 |
-
return {"Hello": "World!"}
|
|
|
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
| 9 |
+
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
@app.get("/infer_t5")
|
| 12 |
def t5(input):
|
| 13 |
+
output = pipe_flan(input)
|
| 14 |
return {"output": output[0]["generated_text"]}
|
| 15 |
|
| 16 |
+
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 17 |
+
|
| 18 |
@app.get("/")
|
| 19 |
def index() -> FileResponse:
|
| 20 |
return FileResponse(path="/app/static/index.html", media_type="text/html")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|