SmilingTree commited on
Commit
933f185
·
1 Parent(s): 4e07e3b

add pipeline

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -2,11 +2,11 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  pipeline = pipeline("text-generation")
5
- result = pipeline("the secret to baking a really good cake is ")
6
 
7
- def greet(name):
8
- # return "Hello " + name + "!!"
9
- return result
 
10
 
11
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
12
  demo.launch()
 
2
  from transformers import pipeline
3
 
4
  pipeline = pipeline("text-generation")
 
5
 
6
+ def text_generate(input_text):
7
+ result = pipeline(input_text)
8
+ result = result[0]["generated_text"]
9
+ return result
10
 
11
+ demo = gr.Interface(fn=text_generate, inputs="text", outputs="text")
12
  demo.launch()