Text-generation / app.py
hema1's picture
Create app.py
d007884
raw
history blame contribute delete
No virus
631 Bytes
#for text generation
import gradio as gr
from transformers import pipeline
text_generator = pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B")
def generate_text(prompt):
generated_text = text_generator(prompt, max_length=200)[0]["generated_text"]
return generated_text
iface1 = gr.Interface(
generate_text,
inputs="text",
outputs="text",
title="Hugging Face Text Generation",
description="Generate text using Hugging Face's GPT-Neo 2.7B model.",
examples=[
["The quick brown fox",],
["Once upon a time",],
["In a galaxy far, far away",],
],
)
iface1.launch()