Dendup commited on
Commit
69f2a9d
1 Parent(s): a02ccb8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Load the model
5
+ story_generator = pipeline('text-generation', model='gpt2')
6
+
7
+ st.title('Interactive Story Creator')
8
+
9
+ # Text area for user input
10
+ user_input = st.text_area("Start your story here...", "Once upon a time")
11
+
12
+ if st.button('Generate Story Continuation'):
13
+ with st.spinner('AI is writing the story...'):
14
+ generated_story = story_generator(user_input, max_length=200)
15
+ st.text_area("Here's the continuation of your story:", generated_story[0]['generated_text'], height=250)