Mohamed-Sami commited on
Commit
47bdc14
·
verified ·
1 Parent(s): 19bc904

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,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
+ return {"output":res[0]['generated_text']}
19
+
20
+
21
+