Spaces:
Build error
Build error
Add application file
Browse files
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
|
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()
|