Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
# Create a text generation pipeline | |
pipe = pipeline("text-generation", model="ismaelfaro/gpt2-poems.en") | |
# Define the Streamlit app | |
st.title("Text Generation with Hugging Face Transformers") | |
# Input for user to provide a seed text | |
seed_text = st.text_input("Enter a seed text:") | |
# Button to generate text | |
if st.button("Generate Text"): | |
if seed_text: | |
generated_text = pipe(seed_text, max_length=50, do_sample=True)[0]['generated_text'] | |
st.write("Generated Text:") | |
st.write(generated_text) | |
else: | |
st.write("Please enter a seed text to generate text.") | |
# Instructions and information | |
st.markdown("This app uses the Hugging Face Transformers library for text generation.") | |
st.markdown("Model: ismaelfaro/gpt2-poems.en") | |
# Provide additional information or options here | |