OnlyForPMs / home.py
ArpitPJain's picture
home.py
ad3172a verified
raw
history blame
499 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.inputs.Textbox(lines=2, placeholder='Enter Text Here...', maxlength=3000),
outputs='text'
)
iface.launch()