Spaces:
Paused
Paused
Update app.py
Browse files1 unmodified line2345674 unmodified lines1213141516171819202122238 unmodified lines3233343536371 unmodified lineimport osimport yt_dlpimport psutil# Function to get system informationdef get_system_info():4 unmodified lines# Streamlit UI setupst.title("YouTube Video Downloader 8K supported")# Display server RAM and disk usageram_info, disk_info = get_system_info()st.write("## Server Information")st.write(f"**RAM Usage:** {ram_info.percent}% used ({ram_info.used // (1024 ** 2)} MB of {ram_info.total // (1024 ** 2)} MB)")st.write(f"**Disk Usage:** {disk_info.percent}% used ({disk_info.used // (1024 ** 3)} GB of {disk_info.total // (1024 ** 3)} GB)")# Streamlit input fieldsurl = st.text_input("Enter the YouTube URL:")quality = st.selectbox("Select the desired quality:", ['4320', '2160', '1440', '1080', '720', '480'])8 unmodified lines'outtmpl': f'{save_file_name}.%(ext)s', # Save the video with the specified name}if st.button("Download"):with st.spinner("Downloading... Please wait."):try:1 unmodified line23456784 unmodified lines1314151617188 unmodified lines2728293031323334353637383940414243444546474849505152531 unmodified lineimport osimport yt_dlpimport psutilimport time# Function to get system informationdef get_system_info():4 unmodified lines# Streamlit UI setupst.title("YouTube Video Downloader 8K supported")# Streamlit input fieldsurl = st.text_input("Enter the YouTube URL:")quality = st.selectbox("Select the desired quality:", ['4320', '2160', '1440', '1080', '720', '480'])8 unmodified lines'outtmpl': f'{save_file_name}.%(ext)s', # Save the video with the specified name}# Placeholder for system infosystem_info_placeholder = st.empty()# Function to update system informationdef update_system_info():ram_info, disk_info = get_system_info()ram_used_gb = ram_info.used / (1024 ** 3)ram_total_gb = ram_info.total / (1024 ** 3)disk_used_gb = disk_info.used / (1024 ** 3)disk_total_gb = disk_info.total / (1024 ** 3)system_info_placeholder.write("## Server Information")system_info_placeholder.write(f"**RAM Usage:** {ram_info.percent}% used ({ram_used_gb:.2f} GB of {ram_total_gb:.2f} GB)")system_info_placeholder.write(f"**Disk Usage:** {disk_info.percent}% used ({disk_used_gb:.2f} GB of {disk_total_gb:.2f} GB)")# Initial system information updateupdate_system_info()# Continuously update system information every 5 secondsst.experimental_rerun() # Optional: Force a rerun to refresh dataif st.button("Download"):with st.spinner("Downloading... Please wait."):try:
app.py+22-6