Spaces:
Runtime error
Runtime error
File size: 572 Bytes
526afa6 ec6901a 526afa6 ec6901a 526afa6 ec6901a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import streamlit as st
from transformers import pipeline
# Load your model; this example uses the GPT-2 model for text generation.
generator = pipeline('text-generation', model='gpt2')
st.title('Hugging Face Model Integration')
# Text input
user_input = st.text_input("Type a sentence to complete", "Streamlit is ")
# Generate text button
if st.button('Generate'):
# Generate text
result = generator(user_input, max_length=50, num_return_sequences=1)
# Display the generated text
st.text_area("Generated Text", result[0]['generated_text'], height=150)
|