|
|
|
import os |
|
import subprocess |
|
import sys |
|
|
|
print("Starting FastSD CPU please wait...") |
|
|
|
|
|
try: |
|
subprocess.run(["python3", "--version"], capture_output=True, check=True) |
|
python_command = "python3" |
|
except subprocess.CalledProcessError: |
|
|
|
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") |
|
|
|
|
|
python_version = subprocess.run( |
|
[python_command, "--version"], |
|
capture_output=True, |
|
text=True |
|
).stdout.split()[1] |
|
print(f"Python version: {python_version}") |
|
|
|
|
|
basedir = os.getcwd() |
|
|
|
|
|
subprocess.run([python_command, "src/app.py", "--api", "--port", "7860"], check=True) |