Spaces:
Sleeping
Sleeping
File size: 489 Bytes
5bc2611 6498503 5bc2611 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from transformers import pipeline
# Initialize Hugging Face pipeline
nlp = pipeline('text-generation', model='gpt2')
def generate_text(input_text):
# Generate text using Hugging Face's GPT-2 model
output_text = nlp(input_text)[0]['generated_text']
return output_text
# Create Gradio Interface
iface = gr.Interface(
fn=generate_text,
inputs=gr.Textbox(lines=2, placeholder='Enter Text Here...', max_lines=5),
outputs='text'
)
iface.launch() |