Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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)
|