start.bat 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. @echo off
  2. chcp 65001
  3. set PYTHONPATH=%~dp0
  4. set PYTHON_CMD=%cd%\fishenv\env\python
  5. set API_FLAG_PATH=%~dp0API_FLAGS.txt
  6. set no_proxy="localhost, 127.0.0.1, 0.0.0.0"
  7. set HF_ENDPOINT=https://hf-mirror.com
  8. %PYTHON_CMD% .\tools\download_models.py
  9. setlocal enabledelayedexpansion
  10. set "API_FLAGS="
  11. set "flags="
  12. if exist "%API_FLAG_PATH%" (
  13. for /f "usebackq tokens=*" %%a in ("%API_FLAG_PATH%") do (
  14. set "line=%%a"
  15. if not "!line:~0,1!"=="#" (
  16. set "line=!line: =<SPACE>!"
  17. set "line=!line:\=!"
  18. set "line=!line:<SPACE>= !"
  19. if not "!line!"=="" (
  20. set "API_FLAGS=!API_FLAGS!!line! "
  21. )
  22. )
  23. )
  24. )
  25. if not "!API_FLAGS!"=="" set "API_FLAGS=!API_FLAGS:~0,-1!"
  26. set "flags="
  27. echo !API_FLAGS! | findstr /C:"--api" >nul 2>&1
  28. if !errorlevel! equ 0 (
  29. echo.
  30. echo Start HTTP API...
  31. set "mode=api"
  32. goto process_flags
  33. )
  34. echo !API_FLAGS! | findstr /C:"--infer" >nul 2>&1
  35. if !errorlevel! equ 0 (
  36. echo.
  37. echo Start WebUI Inference...
  38. set "mode=infer"
  39. goto process_flags
  40. )
  41. :process_flags
  42. for %%p in (!API_FLAGS!) do (
  43. if not "%%p"=="--!mode!" (
  44. set "flags=!flags! %%p"
  45. )
  46. )
  47. if not "!flags!"=="" set "flags=!flags:~1!"
  48. echo Debug: flags = !flags!
  49. if "!mode!"=="api" (
  50. %PYTHON_CMD% -m tools.api !flags!
  51. ) else if "!mode!"=="infer" (
  52. %PYTHON_CMD% -m tools.webui !flags!
  53. )
  54. echo.
  55. echo Next launch the page...
  56. %PYTHON_CMD% fish_speech\webui\manage.py
  57. :end
  58. endlocal
  59. pause