Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# First define a prediction function that takes in a text prompt and returns the text completion
|
| 5 |
+
model = pipeline('text-generation')
|
| 6 |
+
|
| 7 |
+
def predict(prompt):
|
| 8 |
+
completion = model(prompt)[0]['generated_text']
|
| 9 |
+
return completion
|
| 10 |
+
|
| 11 |
+
# Now create the interface
|
| 12 |
+
gr.Interface(fn=predict, inputs="text", outputs="text").launch()
|