Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -159,22 +159,20 @@ def main():
|
|
| 159 |
# Generation button
|
| 160 |
if st.button("β¨ Generate Story & Audio"):
|
| 161 |
with st.spinner("Processing your request..."):
|
| 162 |
-
# Generate outputs
|
| 163 |
-
caption = generate_image_caption(image)
|
| 164 |
-
sys_prompt = "You are a fantasy writer. Create a 100-word adventure story about "
|
| 165 |
-
story = generate_story_content(sys_prompt, caption)
|
| 166 |
-
speech = generate_audio_from_story(story)
|
| 167 |
-
|
| 168 |
-
# Display results
|
| 169 |
with col2:
|
| 170 |
st.subheader("π Scene Description")
|
|
|
|
| 171 |
st.write(caption)
|
| 172 |
|
| 173 |
st.subheader("π Generated Story")
|
|
|
|
|
|
|
| 174 |
st.write(story)
|
| 175 |
|
| 176 |
st.subheader("π Audio Playback")
|
| 177 |
-
|
|
|
|
| 178 |
|
| 179 |
# Download button
|
| 180 |
with open(speech["audio"], "rb") as audio_file:
|
|
|
|
| 159 |
# Generation button
|
| 160 |
if st.button("β¨ Generate Story & Audio"):
|
| 161 |
with st.spinner("Processing your request..."):
|
| 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:
|