Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,22 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
-
from fastapi import FastAPI
|
3 |
-
|
4 |
-
app = FastAPI()
|
5 |
-
|
6 |
-
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
7 |
-
|
8 |
-
@app.get("/")
|
9 |
-
def home():
|
10 |
-
return "hello world"
|
11 |
-
|
12 |
-
|
13 |
-
@app.get("/generate")
|
14 |
-
def generate(text:str):
|
15 |
-
|
16 |
-
res = pipe(text)
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
from fastapi import FastAPI
|
3 |
+
|
4 |
+
app = FastAPI()
|
5 |
+
|
6 |
+
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
7 |
+
|
8 |
+
@app.get("/")
|
9 |
+
def home():
|
10 |
+
return "hello world"
|
11 |
+
|
12 |
+
|
13 |
+
@app.get("/generate")
|
14 |
+
def generate(text:str):
|
15 |
+
|
16 |
+
res = pipe(text)
|
17 |
+
|
18 |
+
|
19 |
+
return {"output":res[0]['generated_text']}
|
20 |
+
|
21 |
+
|
22 |
+
|