Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,13 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
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()
|