[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

@@ -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