[Update] Refactor Hugging Face dependencies in requirements files and enhance cache directory handling in mainloop.py

This commit is contained in:
misyaguziya
2025-05-28 11:14:39 +09:00
parent 8dac3da933
commit 238bd41109
3 changed files with 15 additions and 7 deletions

View File

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

View File

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

View File

@@ -7,9 +7,17 @@ from threading import Thread
from queue import Queue
import warnings
warnings.filterwarnings('ignore')
huggingface_cache_dir = os.path.join(os.path.dirname(__file__), ".cache")
os.makedirs(huggingface_cache_dir, exist_ok=True)
os.environ["HF_HOME"] = os.path.join(huggingface_cache_dir)
if getattr(sys, 'frozen', False):
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