ammoncoder123 commited on
Commit
e462c60
·
verified ·
1 Parent(s): abdcaaa

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +9 -2
chatbot.py CHANGED
@@ -5,8 +5,15 @@ from huggingface_hub import login
5
  import os
6
 
7
  # Force authentication
8
- login(token=os.getenv("HF_TOKEN"))
9
-
 
 
 
 
 
 
 
10
  # ================= CACHE THE MODEL =================
11
  @st.cache_resource
12
  def load_model():
 
5
  import os
6
 
7
  # Force authentication
8
+ hf_token = os.getenv("HF_TOKEN")
9
+ if hf_token:
10
+ try:
11
+ # This confirms your identity to HF
12
+ login(token=hf_token)
13
+ except Exception:
14
+ # If network is down, we just skip login.
15
+ # If the model is public, it will still load.
16
+ pass
17
  # ================= CACHE THE MODEL =================
18
  @st.cache_resource
19
  def load_model():