XquanL commited on
Commit
b4fa516
1 Parent(s): e69a5e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,7 +1,13 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
1
+ from transformers import pipeline
2
  import gradio as gr
3
 
4
+ #define the model
5
+ model = pipeline("text-generation")
6
 
7
+ #define the predict function
8
+ def predict(prompt):
9
+ completion = model(prompt)[0]["generated_text"]
10
+ return completion
11
+
12
+ #define the gradio interface
13
+ gr.Interface(fn=predict, inputs="text", outputs="text").launch()