eraydikyologlu commited on
Commit
774e240
·
1 Parent(s): 5d22a59

Hugging Face ve Whisper için önbellek dizinleri ayarlandı. Logging yapılandırması eklendi ve gerekli çevresel değişkenler tanımlandı.

Browse files
Files changed (1) hide show
  1. main-videopluskazanim.py +20 -0
main-videopluskazanim.py CHANGED
@@ -39,7 +39,27 @@ import kazanim_id_konu_isim_dict_list as kazanimlar
39
  import logging
40
  import whisper
41
  import tempfile
 
 
 
 
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  app = FastAPI(title="Edu-BERT Multi‑Model API")
44
 
45
  # Hugging Face Space CPU kullandığı için device -1 (CPU)
 
39
  import logging
40
  import whisper
41
  import tempfile
42
+ import os
43
+ import logging
44
+ logger = logging.getLogger("uvicorn")
45
+ logger.setLevel(logging.INFO)
46
 
47
+ # Hugging Face cache'ini writable dizine yönlendir
48
+ os.environ["HF_HOME"] = "/tmp/.cache/huggingface"
49
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/.cache/huggingface"
50
+ os.environ["HF_HUB_CACHE"] = "/tmp/.cache/huggingface"
51
+
52
+ # Whisper ve diğer cache'ler için
53
+ os.environ["XDG_CACHE_HOME"] = "/tmp/.cache"
54
+ os.environ["TORCH_HOME"] = "/tmp/.cache/torch"
55
+
56
+ # Whisper model cache için özel dizin
57
+ whisper_cache_dir = "/tmp/.cache/whisper"
58
+ os.makedirs(whisper_cache_dir, exist_ok=True)
59
+ os.environ["WHISPER_CACHE_DIR"] = whisper_cache_dir
60
+
61
+ os.environ["TRANSFORMERS_VERBOSITY"] = "info"
62
+ os.environ["HF_HUB_DISABLE_BIN_TO_SAFETENSORS_CONVERSION"] = "1"
63
  app = FastAPI(title="Edu-BERT Multi‑Model API")
64
 
65
  # Hugging Face Space CPU kullandığı için device -1 (CPU)