berger123 commited on
Commit
d75b016
·
verified ·
1 Parent(s): 20c4fa0

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -21
app.py DELETED
@@ -1,21 +0,0 @@
1
- from fastapi import FastAPI
2
- from transformers import pipeline
3
-
4
-
5
- #create a new fastapi app instance
6
- app = FastAPI()
7
-
8
- #initialize text generation pipeline
9
- pipe = pipeline("text2text-generation", model="google/flan-t5-small")
10
-
11
- @app.get("/")
12
- def home():
13
- return {"Message": "Hello World"}
14
-
15
- #def a function that handle a get request to the /generate endpoint
16
- @app.get("/generate")
17
- def generate(text: str):
18
- #use the pipeline to generate the text from given input text
19
- output = pipe(text)
20
- #return the generated text in json response
21
- return {"generated_text": output[0]["generated_text"]}