Spaces:
Runtime error
Runtime error
File size: 631 Bytes
d007884 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#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() |