import subprocess import sys import os def install_dependencies(): """ Install required dependencies from requirements.txt """ print("Installing dependencies...") try: subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True) print("Dependencies installed successfully!") except subprocess.CalledProcessError as e: print(f"Error installing dependencies: {e}") sys.exit(1) def run_main_script(): """ Run the main gradio script """ print("Starting PIXE 3.5 Image Generator...") try: subprocess.run([sys.executable, "main_gr.py"], check=True) except subprocess.CalledProcessError as e: print(f"Error running main script: {e}") sys.exit(1) if __name__ == "__main__": print("PIXE 3.5 Setup") print("===============") # Install dependencies first install_dependencies() # Run the main application run_main_script()