Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -4,14 +4,11 @@ from transformers import pipeline
|
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
|
| 7 |
-
pipe = pipeline("text-generation", model="
|
| 8 |
|
| 9 |
@app.post("/generate")
|
| 10 |
async def generate_text(text:str):
|
| 11 |
-
|
| 12 |
-
{"role": "user", "content": text},
|
| 13 |
-
]
|
| 14 |
-
output = pipe(messages)
|
| 15 |
return {"output": output}
|
| 16 |
|
| 17 |
@app.get("/")
|
|
|
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
|
| 7 |
+
pipe = pipeline("text-generation", model="google/flan-t5-small")
|
| 8 |
|
| 9 |
@app.post("/generate")
|
| 10 |
async def generate_text(text:str):
|
| 11 |
+
output = pipe(text)
|
|
|
|
|
|
|
|
|
|
| 12 |
return {"output": output}
|
| 13 |
|
| 14 |
@app.get("/")
|