File size: 991 Bytes
5eb7aac ec09029 |
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 28 29 30 31 32 33 34 35 |
#!/usr/bin/env python3
import os
import subprocess
import sys
print("Starting FastSD CPU please wait...")
# Check for Python3
try:
subprocess.run(["python3", "--version"], capture_output=True, check=True)
python_command = "python3"
except subprocess.CalledProcessError:
# If python3 not found, check for python
try:
subprocess.run(["python", "--version"], capture_output=True, check=True)
python_command = "python"
except subprocess.CalledProcessError:
print("Error: Python not found, please install python 3.8 or higher and try again")
sys.exit(1)
print(f"Found {python_command} command")
# Get Python version
python_version = subprocess.run(
[python_command, "--version"],
capture_output=True,
text=True
).stdout.split()[1]
print(f"Python version: {python_version}")
# Get base directory
basedir = os.getcwd()
# Run the application
subprocess.run([python_command, "src/app.py", "--api", "--port", "7860"], check=True) |