|
"""run the steamlit app through this python file""" |
|
|
|
import os |
|
import subprocess |
|
import argparse |
|
|
|
def ensure_folders_exist(script_dir): |
|
images_path = os.path.join(script_dir, "images") |
|
saved_model_path = os.path.join(script_dir, "saved_models") |
|
|
|
|
|
if not os.path.exists(images_path): |
|
os.makedirs(images_path) |
|
|
|
|
|
if not os.path.exists(saved_model_path): |
|
os.makedirs(saved_model_path) |
|
|
|
def run(): |
|
parser = argparse.ArgumentParser() |
|
parser.add_argument("--port", type=int, default=8501, |
|
help="Port number for the Streamlit app") |
|
args = parser.parse_args() |
|
|
|
|
|
script_dir = os.path.dirname(os.path.abspath(__file__)) |
|
|
|
|
|
ensure_folders_exist(script_dir) |
|
|
|
|
|
app_path = os.path.join(script_dir, "app.py") |
|
|
|
|
|
cmd = ["python", "-m", "streamlit", "run", "--server.port", str(args.port), app_path] |
|
subprocess.call(cmd) |
|
|
|
if __name__ == "__main__": |
|
run() |
|
|