Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,11 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from transformers import pipeline
|
| 3 |
-
from huggingface_hub import login
|
| 4 |
-
|
| 5 |
|
| 6 |
## create a new FASTAPI app instance
|
| 7 |
app=FastAPI()
|
| 8 |
|
| 9 |
-
|
| 10 |
# Initialize the text generation pipeline
|
| 11 |
-
pipe = pipeline("
|
| 12 |
|
| 13 |
|
| 14 |
@app.get("/")
|
|
@@ -25,5 +22,3 @@ def generate(text:str):
|
|
| 25 |
|
| 26 |
## return the generate text in Json reposne
|
| 27 |
return {"output":output[0]['generated_text']}
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from transformers import pipeline
|
|
|
|
|
|
|
| 3 |
|
| 4 |
## create a new FASTAPI app instance
|
| 5 |
app=FastAPI()
|
| 6 |
|
|
|
|
| 7 |
# Initialize the text generation pipeline
|
| 8 |
+
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 9 |
|
| 10 |
|
| 11 |
@app.get("/")
|
|
|
|
| 22 |
|
| 23 |
## return the generate text in Json reposne
|
| 24 |
return {"output":output[0]['generated_text']}
|
|
|
|
|
|