File size: 639 Bytes
94ecfcc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import streamlit as st

def run_python_file(file_path):
    try:
        st.text(f"Running {file_path}...")
        os.system(f"python {file_path}")
        st.success("Script executed successfully!")
    except Exception as e:
        st.error(f"Error: {e}")

def main():
    st.title("YTDLBot Runner")

    # Specify the directory and file name
    directory = "ytdlbot"
    file_name = "ytdl_bot.py"
    file_path = os.path.join(directory, file_name)

    st.text(f"Selected file: {file_path}")

    # Run the Python file automatically when the app starts
    run_python_file(file_path)

if __name__ == "__main__":
    main()