Alaaeldin commited on
Commit
2c3c066
·
verified ·
1 Parent(s): 2e86fc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -16,20 +16,14 @@ if torch.cuda.is_available():
16
  else:
17
  st.sidebar.warning("⚠️ CUDA is not available. Using CPU.")
18
 
19
- # Authentication with simplified token handling
20
  try:
21
- # Try to get token
22
  hf_token = os.environ.get("HF_TOKEN")
23
  if not hf_token:
24
- hf_token = st.secrets.get("HF_TOKEN")
25
 
26
- if hf_token:
27
- st.info(f"Token found! First 4 characters: {hf_token[:4]}...")
28
- login(token=hf_token)
29
- status_placeholder.success("🔑 Successfully logged in to Hugging Face!")
30
- else:
31
- st.error("No token found in any location")
32
- st.stop()
33
 
34
  except Exception as e:
35
  st.error(f"🚫 Error with HF token: {str(e)}")
 
16
  else:
17
  st.sidebar.warning("⚠️ CUDA is not available. Using CPU.")
18
 
19
+ # Authentication with minimal token handling
20
  try:
 
21
  hf_token = os.environ.get("HF_TOKEN")
22
  if not hf_token:
23
+ hf_token = st.secrets["HF_TOKEN"]
24
 
25
+ login(token=hf_token)
26
+ st.success("🔑 Successfully logged in to Hugging Face!")
 
 
 
 
 
27
 
28
  except Exception as e:
29
  st.error(f"🚫 Error with HF token: {str(e)}")