Spaces:
Runtime error
Runtime error
BertChristiaens
commited on
Commit
·
5a51f76
1
Parent(s):
f57951a
add better title
Browse files
app.py
CHANGED
@@ -45,15 +45,16 @@ def main():
|
|
45 |
else:
|
46 |
st.success('Downloaded video')
|
47 |
|
48 |
-
if os.path.isfile('audio.mp3'):
|
49 |
video_url = st.session_state.get('latest_video', '/')
|
50 |
-
|
|
|
51 |
st.audio('audio.mp3')
|
52 |
buffer = BytesIO()
|
53 |
with open('audio.mp3', 'rb') as f:
|
54 |
buffer.write(f.read())
|
55 |
timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
|
56 |
-
st.download_button(label='Download mp3', data=buffer.getvalue(), file_name=f'
|
57 |
|
58 |
if __name__ == '__main__':
|
59 |
main()
|
|
|
45 |
else:
|
46 |
st.success('Downloaded video')
|
47 |
|
48 |
+
if os.path.isfile('audio.mp3') and st.session_state.get('latest_video'):
|
49 |
video_url = st.session_state.get('latest_video', '/')
|
50 |
+
video_title = st.session_state.get('latest_title', '/')
|
51 |
+
st.write(f"Last downloaded video is: {video_title} with url {video_url}")
|
52 |
st.audio('audio.mp3')
|
53 |
buffer = BytesIO()
|
54 |
with open('audio.mp3', 'rb') as f:
|
55 |
buffer.write(f.read())
|
56 |
timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
|
57 |
+
st.download_button(label='Download mp3', data=buffer.getvalue(), file_name=f"{video_title.replace(' ', '-')}.mp3', mime='audio/mp3")
|
58 |
|
59 |
if __name__ == '__main__':
|
60 |
main()
|