FaceMask / app.py
tejani's picture
Update app.py
ec09029 verified
raw
history blame
991 Bytes
#!/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)