File size: 316 Bytes
96b496e
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import gradio as gr
from transformers import pipeline

nlp = pipeline('text-generation')

def generate_text(prompt):
  response = nlp(prompt, max_length=100, num_return_sequences=1)[0]
  return response['generated_text']

iface = gr.Interface(generate_text, gr.inputs.Textbox(), gr.outputs.Textbox())
iface.launch()