BeveledCube/bevelapi
1
1import subprocess2 3def run_command(command):4 try:5 result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)6 return result.stdout.strip()7 except subprocess.CalledProcessError as e:8 error_message = e.stderr.decode('utf-8') if hasattr(e.stderr, 'decode') else str(e.stderr)9 return f"Error: {error_message.strip()}"10 11if __name__ == "__main__":12 pip_actions = [13 "install --upgrade pip",14 "install torch",15 "install transformers",16 "install flask",17 "install tensorflow",18 ]19 commands = []20 21 for command in pip_actions:22 print(f"Executing pip action: {command}")23 result = run_command(f"TMPDIR=/home/container/cache python3 -m pip {command}") # IF IT DOESNT WORK MAKE A CACHE DIR24 print(f"Result:\n{result}\n{'='*40}\n")25 26 for command in commands:27 print(f"Running command: {command}")28 result = run_command(f"{command}")29 print(f"Result:\n{result}\n{'='*40}\n")30 