OnlyForPMs / app.py
ArpitPJain's picture
Update app.py
6498503 verified
raw
history blame contribute delete
489 Bytes
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()