Update app.py
Browse files
app.py
CHANGED
@@ -29,12 +29,11 @@ temperature = st.slider("Adjust creativity of the story:", 0.7, 1.5, 1.0)
|
|
29 |
if st.button('Generate Story Continuation'):
|
30 |
with st.spinner('AI is writing the story...'):
|
31 |
# Improved prompt construction with user inputs
|
32 |
-
prompt = f"
|
33 |
|
34 |
try:
|
35 |
-
generated_story = story_generator(prompt, max_length=max_length, temperature=temperature)
|
36 |
-
|
37 |
-
st.text_area("Here's the continuation of your story:", story_text, height=250)
|
38 |
except Exception as e:
|
39 |
st.error(f"Error generating story: {str(e)}")
|
40 |
|
@@ -42,4 +41,3 @@ if st.button('Generate Story Continuation'):
|
|
42 |
feedback = st.text_area("Feedback on the generated story:", "")
|
43 |
if st.button('Submit Feedback'):
|
44 |
st.write("Thanks for your feedback!")
|
45 |
-
|
|
|
29 |
if st.button('Generate Story Continuation'):
|
30 |
with st.spinner('AI is writing the story...'):
|
31 |
# Improved prompt construction with user inputs
|
32 |
+
prompt = f"Genre: {genre}. Main character: {character}. Setting: {setting}. Begin the story with: '{user_input}'"
|
33 |
|
34 |
try:
|
35 |
+
generated_story = story_generator(prompt, max_length=max_length, temperature=temperature)[0]['generated_text']
|
36 |
+
st.text_area("Here's the continuation of your story:", generated_story, height=250)
|
|
|
37 |
except Exception as e:
|
38 |
st.error(f"Error generating story: {str(e)}")
|
39 |
|
|
|
41 |
feedback = st.text_area("Feedback on the generated story:", "")
|
42 |
if st.button('Submit Feedback'):
|
43 |
st.write("Thanks for your feedback!")
|
|