| 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() | |