Areid987 commited on
Commit
af38854
·
verified ·
1 Parent(s): b8a7406

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,12 +1,19 @@
1
  from fastapi import FastAPI
2
  from transformers import pipeline
3
 
 
 
4
  app = FastAPI(docs_url="/")
5
 
6
- pip = pipeline("text2text-generation", model="google/flan-t5-small")
 
7
 
8
  @app.get("/generate")
9
  def generate(text: str):
 
 
 
 
 
10
  output = pipe(text)
11
-
12
  return {"output": output[0]["generated_text"]}
 
1
  from fastapi import FastAPI
2
  from transformers import pipeline
3
 
4
+
5
+
6
  app = FastAPI(docs_url="/")
7
 
8
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
9
+
10
 
11
  @app.get("/generate")
12
  def generate(text: str):
13
+ """
14
+ Using the text2text-generation pipeline from `transformers`, generate text
15
+ from the given input text. The model used is `google/flan-t5-small`, which
16
+ can be found [here](https://huggingface.co/google/flan-t5-small).
17
+ """
18
  output = pipe(text)
 
19
  return {"output": output[0]["generated_text"]}