j-tobias commited on
Commit
378c937
·
1 Parent(s): b64827e

improved login with hf_token

Browse files
Files changed (2) hide show
  1. app.py +5 -3
  2. utils.py +10 -9
app.py CHANGED
@@ -1,11 +1,13 @@
1
  import gradio as gr # needs to be installed
2
-
3
  from dataset import Dataset
4
  from model import Model
 
 
5
 
6
- from utils import hf_login, compute_wer
 
7
 
8
- hf_login()
9
  dataset = Dataset()
10
  models = Model()
11
 
 
1
  import gradio as gr # needs to be installed
2
+ import os
3
  from dataset import Dataset
4
  from model import Model
5
+ from huggingface_hub import login
6
+ from utils import compute_wer
7
 
8
+ hf_token = os.getenv("HF_Token")
9
+ login(token=hf_token, add_to_git_credential=True)
10
 
 
11
  dataset = Dataset()
12
  models = Model()
13
 
utils.py CHANGED
@@ -1,14 +1,15 @@
1
- from huggingface_hub import login
2
- import json
3
  import evaluate
4
- import os
5
 
6
- def hf_login():
7
- hf_token = os.getenv("HF_Token")
8
- # if hf_token is None:
9
- # with open("credentials.json", "r") as f:
10
- # hf_token = json.load(f)["token"]
11
- login(token=hf_token)
 
12
 
13
  def data(dataset):
14
  for i, item in enumerate(dataset):
 
1
+ # from huggingface_hub import login
2
+ # import json
3
  import evaluate
4
+ # import os
5
 
6
+ # def hf_login():
7
+ # hf_token = os.getenv("HF_Token")
8
+ # print(hf_token)
9
+ # # if hf_token is None:
10
+ # # with open("credentials.json", "r") as f:
11
+ # # hf_token = json.load(f)["token"]
12
+ # login(token=hf_token, add_to_git_credential=True)
13
 
14
  def data(dataset):
15
  for i, item in enumerate(dataset):