Dendup's picture
Create app.py
69f2a9d verified
raw
history blame contribute delete
No virus
556 Bytes
import streamlit as st
from transformers import pipeline
# Load the model
story_generator = pipeline('text-generation', model='gpt2')
st.title('Interactive Story Creator')
# Text area for user input
user_input = st.text_area("Start your story here...", "Once upon a time")
if st.button('Generate Story Continuation'):
with st.spinner('AI is writing the story...'):
generated_story = story_generator(user_input, max_length=200)
st.text_area("Here's the continuation of your story:", generated_story[0]['generated_text'], height=250)