|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
pipe = pipeline("text-generation", model="ismaelfaro/gpt2-poems.en") |
|
|
|
|
|
st.title("Text Generation with Hugging Face Transformers") |
|
|
|
|
|
seed_text = st.text_input("Enter a seed 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.") |
|
|
|
|
|
st.markdown("This app uses the Hugging Face Transformers library for text generation.") |
|
st.markdown("Model: ismaelfaro/gpt2-poems.en") |
|
|
|
|
|
|
|
|