Spaces:
Runtime error
Runtime error
umer70112254
commited on
Commit
·
0cbe932
1
Parent(s):
f7b695e
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
from pytube import YouTube
|
3 |
import subprocess
|
|
|
4 |
|
5 |
def download_youtube_video(url):
|
6 |
yt = YouTube(url)
|
@@ -25,7 +26,10 @@ def main():
|
|
25 |
mp3_file = convert_to_mp3(video_filename)
|
26 |
st.success(f"Conversion completed! MP3 file saved as: {mp3_file}")
|
27 |
st.text('Download your file below:')
|
28 |
-
|
|
|
|
|
|
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
main()
|
|
|
1 |
import streamlit as st
|
2 |
from pytube import YouTube
|
3 |
import subprocess
|
4 |
+
import os
|
5 |
|
6 |
def download_youtube_video(url):
|
7 |
yt = YouTube(url)
|
|
|
26 |
mp3_file = convert_to_mp3(video_filename)
|
27 |
st.success(f"Conversion completed! MP3 file saved as: {mp3_file}")
|
28 |
st.text('Download your file below:')
|
29 |
+
if os.path.exists(mp3_file):
|
30 |
+
with open(mp3_file, 'rb') as f:
|
31 |
+
data = f.read()
|
32 |
+
st.download_button(label='Click here to download', data=data, file_name='converted_audio.mp3', mime='audio/mp3')
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
main()
|