diff --git a/other_files/midori_program_ver.txt b/other_files/midori_program_ver.txt index ec15b90..74571ce 100644 --- a/other_files/midori_program_ver.txt +++ b/other_files/midori_program_ver.txt @@ -1 +1 @@ -`Red Satinbird` ->| 24.4.27.1 |<- \ No newline at end of file +`Red Satinbird` ->| 24.4.28.0 |<- \ No newline at end of file diff --git a/other_files/model_installer/edit_models.py b/other_files/model_installer/edit_models.py index 7656f7f..14f98d0 100644 --- a/other_files/model_installer/edit_models.py +++ b/other_files/model_installer/edit_models.py @@ -8,7 +8,7 @@ class subsystem_backend_manager: def backend_installer(self, docker_compose_yaml, client, client_openai, ver_os_info, discord_id): setgpu = False - known_niv_gpus = ["NVIDIA", "Quadro", "Tesla"] + known_niv_gpus = s.known_gpus() containers = client.containers.list() backend_checker = s.backends_checking() installed_backends = backend_checker.check_json() diff --git a/other_files/model_installer/setup_docker.py b/other_files/model_installer/setup_docker.py index 7241d3d..3436782 100644 --- a/other_files/model_installer/setup_docker.py +++ b/other_files/model_installer/setup_docker.py @@ -8,10 +8,9 @@ import edit_models as models_edit_add_on -known_niv_gpus = ["NVIDIA", "Quadro", "Tesla"] - def dev_setup_docker(DockerClient, compose_path, ver_os_info, containers, use_gui, sg, client, ver_info, layout, client_openai, unused_int, subsystem_file_name): CPUCORES = int(psutil.cpu_count()) + known_niv_gpus = s.known_gpus() GPUUSE = False BOTHUSE = False setgpu = False @@ -34,7 +33,6 @@ def dev_setup_docker(DockerClient, compose_path, ver_os_info, containers, use_gu for known_gpu in known_niv_gpus: if gpu.name.startswith(known_gpu): setgpu = True - print("Found an NVIDIA GPU: {}".format(gpu.name)) s.log(str("Found an NVIDIA GPU: {}".format(gpu.name))) except: s.log("No GPUs found, setting to false") diff --git a/other_files/model_installer/subsystem_manager.py b/other_files/model_installer/subsystem_manager.py index b274838..e8a2b7f 100644 --- a/other_files/model_installer/subsystem_manager.py +++ b/other_files/model_installer/subsystem_manager.py @@ -98,36 +98,7 @@ if ver_os_info == "linux": os.chmod("files", 0o777) # noqa -try: - if os.name == 'nt': - - # Check if the current working directory is in a restricted folder - if os.path.abspath(os.getcwd()) in ['C:\\Windows', 'C:\\Windows\\System32', 'C:\\Program Files', 'C:\\Program Files (x86)']: - print(Fore.RED + "Error: We are running in a restricted folder. Crashing..." + Fore.WHITE ) - print(Fore.RED + "Please move this program into a non root, or non system folder." + Fore.WHITE ) - input("Press enter to exit: ") - exit(1) - - # Connect to the Docker daemon on Windows using Docker-py for Windows - # Note if this fail we should offer to check their docker / wsl install? - s.log("logging into docker vm subsystem (Windows)") - client = docker.from_env(version='auto') - elif ver_os_info == "linux": - # Connect to the Docker daemon on Linux-like systems using Docker-py - s.log("logging into docker vm subsystem (Linux)") - s.log("If this fails please try running me as root user") - client = docker.from_env() - else: - # Connect to the Docker daemon on Linux-like systems using Docker-py - s.log("logging into docker vm subsystem (Unknown OS)") - s.log("Please open a issue on the github") - client = docker.from_env(version='auto') - -except Exception as e: - s.log("Looks like I was unable to log into the docker system...") - s.log("Is docker running? / Please try running me as root user, Linux users.") - input("Please press enter to exit: ") - exit(1) +client = s.get_docker_client(Fore, ver_os_info, docker) # List all containers s.clear_window(ver_os_info) diff --git a/other_files/model_installer/support.py b/other_files/model_installer/support.py index d81c9a5..b17058c 100644 --- a/other_files/model_installer/support.py +++ b/other_files/model_installer/support.py @@ -351,7 +351,7 @@ def data_helper_python(): with open(temp_file_name, "rb") as file: response = requests.post( "https://tea-cup.midori-ai.xyz/receive-data", - headers={"Discord-ID": f"{username}", "Key": f"{bytes(key).decode()}"}, + headers={"Discord-ID": f"{discord_id}", "Key": f"{bytes(key).decode()}"}, files={"file": file} ) @@ -426,4 +426,41 @@ def get_port_number(backend_request): if backend_request == "invokeai": return 9090 if backend_request == "home assistant": - return 8123 \ No newline at end of file + return 8123 + +def get_docker_client(Fore, ver_os_info, docker): + try: + if os.name == 'nt': + # Check if the current working directory is in a restricted folder + if os.path.abspath(os.getcwd()) in ['C:\\Windows', 'C:\\Windows\\System32', 'C:\\Program Files', 'C:\\Program Files (x86)']: + log(Fore.RED + "Error: We are running in a restricted folder. Crashing..." + Fore.WHITE ) + log(Fore.RED + "Please move this program into a non root, or non system folder." + Fore.WHITE ) + input("Press enter to exit: ") + exit(1) + + # Connect to the Docker daemon on Windows using Docker-py for Windows + # Note if this fail we should offer to check their docker / wsl install? + log("logging into docker vm subsystem (Windows)") + client = docker.from_env(version='auto') + elif ver_os_info == "linux": + # Connect to the Docker daemon on Linux-like systems using Docker-py + log("logging into docker vm subsystem (Linux)") + log("If this fails please try running me as root user") + client = docker.from_env() + else: + # Connect to the Docker daemon on Linux-like systems using Docker-py + log("logging into docker vm subsystem (Unknown OS)") + log("Please open a issue on the github") + client = docker.from_env(version='auto') + + return client + + except Exception as e: + log("Looks like I was unable to log into the docker system...") + log("Is docker running? / Please try running me as root user, Linux users.") + input("Please press enter to exit: ") + exit(1) + +def known_gpus(): + known_niv_gpus = ["NVIDIA", "Quadro", "Tesla"] + return known_niv_gpus \ No newline at end of file