Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
nlp = pipeline('text-generation')
|
5 |
+
|
6 |
+
def generate_text(prompt):
|
7 |
+
response = nlp(prompt, max_length=100, num_return_sequences=1)[0]
|
8 |
+
return response['generated_text']
|
9 |
+
|
10 |
+
iface = gr.Interface(generate_text, gr.inputs.Textbox(), gr.outputs.Textbox())
|
11 |
+
iface.launch()
|