ccclllwww commited on
Commit
0f3e58e
Β·
verified Β·
1 Parent(s): a200433

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -17
app.py CHANGED
@@ -133,6 +133,7 @@ def main():
133
  layout="wide",
134
  initial_sidebar_state="collapsed"
135
  )
 
136
 
137
  # Title and description
138
  st.title("πŸ§™β€β™‚οΈ Fantasy Adventure Story Generator")
@@ -142,6 +143,17 @@ def main():
142
  - AI-generated adventure story
143
  - Audio version of the story
144
  """)
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  # File uploader
147
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
@@ -162,26 +174,20 @@ def main():
162
  # Generate outputs and Display results
163
  with col2:
164
  st.subheader("πŸ” Scene Description")
165
- caption = generate_image_caption(image)
166
- st.write(caption)
 
167
 
168
  st.subheader("πŸ“– Generated Story")
169
- sys_prompt = "You are a fantasy writer. Create a 100-word adventure story about "
170
- story = generate_story_content(sys_prompt, caption)
171
- st.write(story)
 
172
 
173
  st.subheader("πŸ”Š Audio Playback")
174
- speech = generate_audio_from_story(story)
175
- st.audio(speech["audio"], sample_rate=speech["sampling_rate"], format='audio/wav')
176
-
177
- # Download button
178
- with open(speech["audio"], "rb") as audio_file:
179
- st.download_button(
180
- label="πŸ“₯ Download Audio",
181
- data=audio_file,
182
- file_name="fantasy_adventure.wav",
183
- mime="audio/wav"
184
- )
185
-
186
  if __name__ == "__main__":
187
  main()
 
133
  layout="wide",
134
  initial_sidebar_state="collapsed"
135
  )
136
+
137
 
138
  # Title and description
139
  st.title("πŸ§™β€β™‚οΈ Fantasy Adventure Story Generator")
 
143
  - AI-generated adventure story
144
  - Audio version of the story
145
  """)
146
+
147
+ # Help section
148
+ st.markdown("---")
149
+ st.subheader("🌟 How to Use:")
150
+ st.info("""
151
+ 1. Upload any picture (animals, nature, or people work best!)
152
+ 2. Choose your favorite story style
153
+ 3. Click the confirmation button
154
+ 4. Wait for image analysis to complete
155
+ 5. Enjoy your personalized story and audio!
156
+ """)
157
 
158
  # File uploader
159
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
 
174
  # Generate outputs and Display results
175
  with col2:
176
  st.subheader("πŸ” Scene Description")
177
+ with st.spinner("Preparing story caption..."):
178
+ caption = generate_image_caption(image)
179
+ st.write(caption)
180
 
181
  st.subheader("πŸ“– Generated Story")
182
+ with st.spinner("Preparing story..."):
183
+ sys_prompt = "You are a fantasy writer. Create a 100-word adventure story about "
184
+ story = generate_story_content(sys_prompt, caption)
185
+ st.write(story)
186
 
187
  st.subheader("πŸ”Š Audio Playback")
188
+ with st.spinner("Preparing speech..."):
189
+ speech = generate_audio_from_story(story)
190
+ st.audio(speech["audio"], sample_rate=speech["sampling_rate"], format='audio/wav')
191
+
 
 
 
 
 
 
 
 
192
  if __name__ == "__main__":
193
  main()