[Update] Enhance build scripts and requirements for Hugging Face integration; improve logging and error handling

This commit is contained in:
misyaguziya
2025-05-29 08:04:06 +09:00
parent 238bd41109
commit 67d06ab1e1
7 changed files with 23 additions and 29 deletions

View File

@@ -1,2 +1,2 @@
call .venv/Scripts/activate call .venv/Scripts/activate
pyinstaller backend.spec --distpath src-tauri/bin --clean --noconfirm pyinstaller backend.spec --distpath src-tauri/bin --clean --noconfirm --log-level ERROR

View File

@@ -1,2 +1,2 @@
call .venv_cuda/Scripts/activate call .venv_cuda/Scripts/activate
pyinstaller backend_cuda.spec --distpath src-tauri/bin --clean --noconfirm pyinstaller backend_cuda.spec --distpath src-tauri/bin --clean --noconfirm --log-level ERROR

View File

@@ -1,21 +1,25 @@
REM .venv .venv_cuda があれば削除 REM .venv exists
if exist .venv ( if exist .venv (
rmdir /s /q .venv rmdir /s /q .venv
) )
if exist .venv_cuda ( REM make .venv
rmdir /s /q .venv_cuda
)
REM .venv .venv_cuda を作成
python -m venv .venv python -m venv .venv
python -m venv .venv_cuda
REM .venv .venv_cuda に必要なパッケージをインストール REM install packages for .venv
call .venv/Scripts/activate call .venv/Scripts/activate
python.exe -m pip install --upgrade pip python.exe -m pip install --upgrade pip
pip install --no-cache-dir --force-reinstall -r requirements.txt pip install --no-cache-dir --force-reinstall -r requirements.txt
REM if .venv_cuda exists
if exist .venv_cuda (
rmdir /s /q .venv_cuda
)
REM make .venv_cuda
python -m venv .venv_cuda
REM install packages for .venv_cuda
call .venv_cuda/Scripts/activate call .venv_cuda/Scripts/activate
python.exe -m pip install --upgrade pip python.exe -m pip install --upgrade pip
pip install --no-cache-dir --force-reinstall -r requirements_cuda.txt pip install --no-cache-dir --force-reinstall -r requirements_cuda.txt

View File

@@ -16,7 +16,8 @@ psutil==5.9.8
pykakasi==2.3.0 pykakasi==2.3.0
pycaw==20240210 pycaw==20240210
websockets==15.0.1 websockets==15.0.1
huggingface_hub[hf-xet] huggingface_hub==0.32.2
hf-xet==1.1.2
setuptools==80.8.0 setuptools==80.8.0
translators @ git+https://github.com/misyaguziya/translators@5.9.2.1 translators @ git+https://github.com/misyaguziya/translators@5.9.2.1
SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1 SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1

View File

@@ -17,7 +17,8 @@ psutil==5.9.8
pykakasi==2.3.0 pykakasi==2.3.0
pycaw==20240210 pycaw==20240210
websockets==15.0.1 websockets==15.0.1
huggingface[hub] huggingface_hub==0.32.2
hf-xet==1.1.2
setuptools==80.8.0 setuptools==80.8.0
translators @ git+https://github.com/misyaguziya/translators@5.9.2.1 translators @ git+https://github.com/misyaguziya/translators@5.9.2.1
SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1 SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1

View File

@@ -1,4 +1,4 @@
from typing import Callable, Union, Any from typing import Callable, Any
from time import sleep from time import sleep
from subprocess import Popen from subprocess import Popen
from threading import Thread from threading import Thread

View File

@@ -1,26 +1,14 @@
import os
import sys import sys
import json import json
import time import time
from typing import Any from typing import Any
from threading import Thread from threading import Thread
from queue import Queue from queue import Queue
import warnings import logging
warnings.filterwarnings('ignore') from controller import Controller # noqa: E402
from utils import printLog, printResponse, errorLogging, encodeBase64 # noqa: E402
if getattr(sys, 'frozen', False): logging.getLogger("huggingface_hub").setLevel(logging.ERROR)
cache_dir = os.path.join(os.path.dirname(sys.executable), ".cache")
hub_dir = os.path.join(os.path.dirname(sys.executable), ".cache", "hub")
else:
cache_dir = os.path.join(os.path.dirname(__file__), ".cache")
hub_dir = os.path.join(os.path.dirname(__file__), ".cache", "hub")
os.makedirs(cache_dir, exist_ok=True)
os.makedirs(hub_dir, exist_ok=True)
os.environ["HF_HOME"] = os.path.join(cache_dir)
from controller import Controller
from utils import printLog, printResponse, errorLogging, encodeBase64
run_mapping = { run_mapping = {
"connected_network":"/run/connected_network", "connected_network":"/run/connected_network",