Wauplin HF staff commited on
Commit
2d3f3a0
1 Parent(s): e74606e

(nit) Proper login in status_checker

Browse files

Since `huggingface_hub>=0.11`, you can use the generic `login(token:Optional[str] = None)`method anywhere.

If you provide a token, it will be saved. If `None`, it will prompt the user for a token either in a notebook widget (equivalent of `notebook_login`) or in the terminal (equivalent of `huggingface-cli login`) => it is not the preferred way to login on any machine, regardless of the setup (notebook or script). Not sure it will play nicely in a Space if `HF_TOKEN` is not set but `HfFolder.save_token` would have also failed anyway so let's assume it's set.

Files changed (1) hide show
  1. status_checker.py +2 -2
status_checker.py CHANGED
@@ -2,13 +2,13 @@ import os
2
  from pathlib import Path
3
  from threading import Thread
4
  import gradio as gr
5
- from huggingface_hub import upload_folder, HfFolder, delete_repo
6
  import sys
7
  import time
8
  import subprocess
9
 
10
 
11
- HfFolder().save_token(os.getenv("HF_TOKEN"))
12
 
13
  # Where outputs from user script will be pushed to for safe keeping
14
  output_dataset_id = "nateraw/asdf123"
2
  from pathlib import Path
3
  from threading import Thread
4
  import gradio as gr
5
+ from huggingface_hub import upload_folder, login, delete_repo
6
  import sys
7
  import time
8
  import subprocess
9
 
10
 
11
+ login(os.getenv("HF_TOKEN"))
12
 
13
  # Where outputs from user script will be pushed to for safe keeping
14
  output_dataset_id = "nateraw/asdf123"