mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-21 02:18:24 +02:00
Make it work on Windows
This commit is contained in:
parent
53a79c1a81
commit
8e7a6077e5
@ -177,17 +177,12 @@ Thanks!"""
|
|||||||
### Launcher
|
### Launcher
|
||||||
|
|
||||||
def get_config():
|
def get_config():
|
||||||
# The config file is in the same directory as this script
|
|
||||||
config_directory = os.path.dirname(__file__)
|
config_directory = os.path.dirname(__file__)
|
||||||
config_yaml = os.path.join(config_directory, "config.yaml")
|
config_yaml = os.path.join(config_directory, "..", "config.yaml")
|
||||||
config_json = os.path.join(config_directory, "config.json")
|
config_json = os.path.join(config_directory, "config.json")
|
||||||
|
|
||||||
config = None
|
config = None
|
||||||
|
|
||||||
# Defaults
|
|
||||||
listen_port = 9000
|
|
||||||
bind_ip = "127.0.0.1"
|
|
||||||
|
|
||||||
# migrate the old config yaml location
|
# migrate the old config yaml location
|
||||||
config_legacy_yaml = os.path.join(config_directory, "config.yaml")
|
config_legacy_yaml = os.path.join(config_directory, "config.yaml")
|
||||||
if os.path.isfile(config_legacy_yaml):
|
if os.path.isfile(config_legacy_yaml):
|
||||||
@ -211,7 +206,6 @@ def get_config():
|
|||||||
|
|
||||||
if config is None:
|
if config is None:
|
||||||
config = {}
|
config = {}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def setup_amd_environment():
|
def setup_amd_environment():
|
||||||
@ -264,6 +258,7 @@ def launch_uvicorn():
|
|||||||
print(f"Version: {platform. python_version()}")
|
print(f"Version: {platform. python_version()}")
|
||||||
|
|
||||||
bind_ip = "127.0.0.1"
|
bind_ip = "127.0.0.1"
|
||||||
|
listen_port = 9000
|
||||||
if "net" in config:
|
if "net" in config:
|
||||||
print("Checking network settings")
|
print("Checking network settings")
|
||||||
if "listen_port" in config["net"]:
|
if "listen_port" in config["net"]:
|
||||||
@ -282,12 +277,7 @@ def launch_uvicorn():
|
|||||||
setup_amd_environment()
|
setup_amd_environment()
|
||||||
|
|
||||||
print("\nLaunching uvicorn\n")
|
print("\nLaunching uvicorn\n")
|
||||||
os.execlp("python", "python", "-m", "uvicorn",
|
os.system(f'python -m uvicorn main:server_api --app-dir "{os.environ["SD_UI_PATH"]}" --port {listen_port} --host {bind_ip} --log-level error')
|
||||||
"main:server_api",
|
|
||||||
"--app-dir", os.environ["SD_UI_PATH"],
|
|
||||||
"--port", str(listen_port),
|
|
||||||
"--host", bind_ip,
|
|
||||||
"--log-level", "error")
|
|
||||||
|
|
||||||
### Start
|
### Start
|
||||||
|
|
||||||
|
@ -52,73 +52,24 @@ if exist ldm rename ldm ldm-old
|
|||||||
if not exist "%INSTALL_ENV_DIR%\DLLs\libssl-1_1-x64.dll" copy "%INSTALL_ENV_DIR%\Library\bin\libssl-1_1-x64.dll" "%INSTALL_ENV_DIR%\DLLs\"
|
if not exist "%INSTALL_ENV_DIR%\DLLs\libssl-1_1-x64.dll" copy "%INSTALL_ENV_DIR%\Library\bin\libssl-1_1-x64.dll" "%INSTALL_ENV_DIR%\DLLs\"
|
||||||
if not exist "%INSTALL_ENV_DIR%\DLLs\libcrypto-1_1-x64.dll" copy "%INSTALL_ENV_DIR%\Library\bin\libcrypto-1_1-x64.dll" "%INSTALL_ENV_DIR%\DLLs\"
|
if not exist "%INSTALL_ENV_DIR%\DLLs\libcrypto-1_1-x64.dll" copy "%INSTALL_ENV_DIR%\Library\bin\libcrypto-1_1-x64.dll" "%INSTALL_ENV_DIR%\DLLs\"
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
@rem set any overrides
|
||||||
|
set HF_HUB_DISABLE_SYMLINKS_WARNING=true
|
||||||
|
|
||||||
@rem install or upgrade the required modules
|
@rem install or upgrade the required modules
|
||||||
set PATH=C:\Windows\System32;%PATH%
|
set PATH=C:\Windows\System32;%PATH%
|
||||||
|
|
||||||
@REM prevent from using packages from the user's home directory, to avoid conflicts
|
@REM prevent from using packages from the user's home directory, to avoid conflicts
|
||||||
set PYTHONNOUSERSITE=1
|
set PYTHONNOUSERSITE=1
|
||||||
set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages
|
|
||||||
|
|
||||||
@rem Download the required packages
|
|
||||||
call python ..\scripts\check_modules.py
|
|
||||||
if "%ERRORLEVEL%" NEQ "0" (
|
|
||||||
pause
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
call WHERE uvicorn > .tmp
|
|
||||||
@>nul findstr /m "uvicorn" .tmp
|
|
||||||
@if "%ERRORLEVEL%" NEQ "0" (
|
|
||||||
@echo. & echo "UI packages not found! Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/easydiffusion/easydiffusion/issues" & echo "Thanks!" & echo.
|
|
||||||
pause
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
@>nul findstr /m "conda_sd_ui_deps_installed" ..\scripts\install_status.txt
|
|
||||||
@if "%ERRORLEVEL%" NEQ "0" (
|
|
||||||
@echo conda_sd_ui_deps_installed >> ..\scripts\install_status.txt
|
|
||||||
)
|
|
||||||
|
|
||||||
@>nul findstr /m "sd_install_complete" ..\scripts\install_status.txt
|
|
||||||
@if "%ERRORLEVEL%" NEQ "0" (
|
|
||||||
@echo sd_weights_downloaded >> ..\scripts\install_status.txt
|
|
||||||
@echo sd_install_complete >> ..\scripts\install_status.txt
|
|
||||||
)
|
|
||||||
|
|
||||||
@echo. & echo "Easy Diffusion installation complete! Starting the server!" & echo.
|
|
||||||
|
|
||||||
@set SD_DIR=%cd%
|
|
||||||
|
|
||||||
set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages
|
set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages
|
||||||
echo PYTHONPATH=%PYTHONPATH%
|
echo PYTHONPATH=%PYTHONPATH%
|
||||||
|
|
||||||
|
@rem Download the required packages
|
||||||
call where python
|
call where python
|
||||||
call python --version
|
call python --version
|
||||||
|
|
||||||
@cd ..
|
call python scripts\check_modules.py --launch-uvicorn
|
||||||
@set SD_UI_PATH=%cd%\ui
|
pause
|
||||||
|
exit /b
|
||||||
|
|
||||||
@FOR /F "tokens=* USEBACKQ" %%F IN (`python scripts\get_config.py --default=9000 net listen_port`) DO (
|
|
||||||
@SET ED_BIND_PORT=%%F
|
|
||||||
)
|
|
||||||
|
|
||||||
@FOR /F "tokens=* USEBACKQ" %%F IN (`python scripts\get_config.py --default=False net listen_to_network`) DO (
|
|
||||||
if "%%F" EQU "True" (
|
|
||||||
@FOR /F "tokens=* USEBACKQ" %%G IN (`python scripts\get_config.py --default=0.0.0.0 net bind_ip`) DO (
|
|
||||||
@SET ED_BIND_IP=%%G
|
|
||||||
)
|
|
||||||
) else (
|
|
||||||
@SET ED_BIND_IP=127.0.0.1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@cd stable-diffusion
|
|
||||||
|
|
||||||
@rem set any overrides
|
|
||||||
set HF_HUB_DISABLE_SYMLINKS_WARNING=true
|
|
||||||
|
|
||||||
@python -m uvicorn main:server_api --app-dir "%SD_UI_PATH%" --port %ED_BIND_PORT% --host %ED_BIND_IP% --log-level error
|
|
||||||
|
|
||||||
|
|
||||||
@pause
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user