rachith commited on
Commit
4257568
1 Parent(s): e38d825

Add application file

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -1,7 +1,19 @@
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
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # def greet(name):
5
+ # return "Hello " + name + "!!"
6
 
7
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
8
+ # iface.launch()
9
+
10
+ model = pipeline("text-generation")
11
+
12
+
13
+ def predict(prompt):
14
+ completion = model(prompt)[0]["generated_text"]
15
+ return completion
16
+
17
+ predict("My favorite programming language is")
18
+
19
+ gr.Interface(fn=predict, inputs="text", outputs="text").launch()