smjain commited on
Commit
8b529d8
1 Parent(s): c3f2d33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,12 +1,14 @@
1
  import os
 
2
  from huggingface_hub import login
3
 
4
 
5
 
6
  # Example command to set an environment variable (this is not effective for parent Python processes)
7
  token=os.environ['token']
8
- access_token_read = token
9
- login(token = access_token_read)
 
10
  #os.environ['HUGGINGFACE_TOKEN'] = token
11
 
12
  # This will not make HUGGINGFACE_TOKEN accessible in the Python script outside the os.system call.
 
1
  import os
2
+ import subprocess
3
  from huggingface_hub import login
4
 
5
 
6
 
7
  # Example command to set an environment variable (this is not effective for parent Python processes)
8
  token=os.environ['token']
9
+ #access_token_read = token
10
+ #login(token = access_token_read)
11
+ subprocess.run(["huggingface-cli", "login", "--token", token])
12
  #os.environ['HUGGINGFACE_TOKEN'] = token
13
 
14
  # This will not make HUGGINGFACE_TOKEN accessible in the Python script outside the os.system call.