File size: 556 Bytes
69f2a9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)