model search
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# Python-generated files
|
||||
__pycache__/
|
||||
*.py[oc]
|
||||
build/
|
||||
dist/
|
||||
wheels/
|
||||
*.egg-info
|
||||
|
||||
# Virtual environments
|
||||
.venv
|
||||
@@ -0,0 +1 @@
|
||||
3.12
|
||||
@@ -0,0 +1,63 @@
|
||||
import os
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import importlib.util
|
||||
|
||||
__FILE__ = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
module_path = Path(f"{__FILE__}/../../manage_deps.py")
|
||||
|
||||
print(module_path)
|
||||
|
||||
requireDep = importlib.util.spec_from_file_location(
|
||||
"my_module",
|
||||
module_path
|
||||
)
|
||||
|
||||
module = importlib.util.module_from_spec(requireDep)
|
||||
requireDep.loader.exec_module(module)
|
||||
|
||||
module.ensure_dependency("rust_civit_comfy_bindings")
|
||||
|
||||
from rust_civit_comfy_bindings import sum_as_string, start_server
|
||||
|
||||
import socketserver
|
||||
import socket
|
||||
|
||||
def is_port_free(port, host="127.0.0.1"):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
return s.connect_ex((host, port)) != 0
|
||||
|
||||
if is_port_free(3090):
|
||||
port = 3090
|
||||
else:
|
||||
with socketserver.TCPServer(("localhost", 0), None) as server:
|
||||
port = server.server_address[1]
|
||||
|
||||
from multiprocessing import Process
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
static_dir = f"{__FILE__}/../../front-end/build"
|
||||
comfy_path = Path(f"C:/ComfyUI").resolve()
|
||||
print(f"Comfy path: {comfy_path}. Dont forget to update this if yours is different")
|
||||
|
||||
def main():
|
||||
import sys
|
||||
|
||||
subprocess.Popen(
|
||||
[sys.executable, f"{__FILE__}/../../server.py", f"{port}", static_dir, comfy_path],
|
||||
stdin=subprocess.DEVNULL,
|
||||
stdout=None,
|
||||
stderr=None,
|
||||
close_fds=True
|
||||
)
|
||||
|
||||
print("Running server on another process with port:", port)
|
||||
|
||||
while True:
|
||||
""
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,7 @@
|
||||
[project]
|
||||
name = "teste"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = []
|
||||
@@ -0,0 +1,27 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
def pip_install(pkg):
|
||||
wheel = Path(pkg).resolve()
|
||||
|
||||
whl_files = [f for f in os.listdir(wheel) if f.endswith('.whl')]
|
||||
|
||||
whl_files.sort(reverse=True)
|
||||
|
||||
wheel = f"{wheel}/{whl_files[0]}"
|
||||
|
||||
subprocess.check_call([
|
||||
sys.executable, "-m", "pip", "install", "--force-reinstall", str(wheel)
|
||||
])
|
||||
|
||||
import importlib.util
|
||||
|
||||
def ensure(pkg):
|
||||
if importlib.util.find_spec(pkg) is None:
|
||||
pip_install(pkg)
|
||||
|
||||
|
||||
def ensure_dependency(name: str):
|
||||
pip_install(name)
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
version = 1
|
||||
revision = 2
|
||||
requires-python = ">=3.12"
|
||||
|
||||
[[package]]
|
||||
name = "teste"
|
||||
version = "0.1.0"
|
||||
source = { virtual = "." }
|
||||
Reference in New Issue
Block a user