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

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

No files matched your search

+11 -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