Spaces:
Sleeping
Sleeping
simplify dockerfile
Browse files
app.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
app = FastAPI()
|
5 |
|
6 |
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
7 |
|
8 |
-
@app.get("/")
|
9 |
def generate(text: str):
|
10 |
output = pipe(text)
|
11 |
return {"output": output[0]["generated_text"]}
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
app = FastAPI(docs_url="/")
|
5 |
|
6 |
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
7 |
|
8 |
+
@app.get("/generate")
|
9 |
def generate(text: str):
|
10 |
output = pipe(text)
|
11 |
return {"output": output[0]["generated_text"]}
|