imanoop7 commited on
Commit
12c9068
·
verified ·
1 Parent(s): 30b58ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -19
app.py CHANGED
@@ -1,19 +1,20 @@
1
- from transformers import pipeline# Use a pipeline as a high-level helper
2
- from fastapi import FastAPI
3
-
4
-
5
-
6
- app = FastAPI()
7
-
8
- pipe = pipeline("text2text-generation", model="google/flan-t5-small")
9
-
10
- @app.get("/")
11
- def home():
12
- return {"message":"Hello World"}
13
-
14
- @app.get("generate")
15
- def generate(text:str):
16
- output = pipe(text)
17
-
18
- return {"output":output[0]['generated_text']}
19
-
 
 
1
+ from transformers import pipeline# Use a pipeline as a high-level helper
2
+ from fastapi import FastAPI
3
+
4
+
5
+
6
+ app = FastAPI()
7
+
8
+ #hugging face pipline
9
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
10
+
11
+ @app.get("/")
12
+ def home():
13
+ return {"message":"Hello World"}
14
+
15
+ @app.get("generate")
16
+ def generate(text:str):
17
+ output = pipe(text)
18
+
19
+ return {"output":output[0]['generated_text']}
20
+