nexusbert commited on
Commit
27c6dfe
·
1 Parent(s): 8e783bb
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -52,6 +52,8 @@ def load_models():
52
  global tts_ha, tts_en, tts_yo, tts_ig
53
  device = 0 if torch.cuda.is_available() else -1
54
  hf_token = os.getenv("HF_TOKEN")
 
 
55
  if not hf_token:
56
  logger.warning("HF_TOKEN not set! This may cause authentication failures for gated repositories.")
57
  logger.warning("Please set HF_TOKEN environment variable to access restricted models.")
@@ -91,6 +93,8 @@ def _get_asr(lang_code: str):
91
  return entry["model"], entry["proc"]
92
  repo_id = entry["repo"]
93
  hf_token = os.getenv("HF_TOKEN")
 
 
94
  try:
95
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
96
  logger.info(f"Lazy-loading ASR for {lang_code} from {repo_id}...")
 
52
  global tts_ha, tts_en, tts_yo, tts_ig
53
  device = 0 if torch.cuda.is_available() else -1
54
  hf_token = os.getenv("HF_TOKEN")
55
+ if hf_token:
56
+ hf_token = hf_token.strip()
57
  if not hf_token:
58
  logger.warning("HF_TOKEN not set! This may cause authentication failures for gated repositories.")
59
  logger.warning("Please set HF_TOKEN environment variable to access restricted models.")
 
93
  return entry["model"], entry["proc"]
94
  repo_id = entry["repo"]
95
  hf_token = os.getenv("HF_TOKEN")
96
+ if hf_token:
97
+ hf_token = hf_token.strip()
98
  try:
99
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
100
  logger.info(f"Lazy-loading ASR for {lang_code} from {repo_id}...")