lewtun HF staff commited on
Commit
94a4e9f
1 Parent(s): c00ae85

Fix AutoNLP login

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. requirements.txt +0 -1
app.py CHANGED
@@ -8,7 +8,7 @@ from pathlib import Path
8
 
9
  import streamlit as st
10
  from dotenv import load_dotenv
11
- from huggingface_hub import Repository, whoami
12
 
13
  from validate import validate_submission
14
 
@@ -18,7 +18,7 @@ if Path(".env").is_file():
18
  HF_TOKEN = os.getenv("HF_TOKEN")
19
 
20
  # AutoNLP login
21
- autonlp_login = subprocess.run(["autonlp", "login", f"--api-key {HF_TOKEN}"], stdout=subprocess.PIPE)
22
  if autonlp_login.returncode == -1:
23
  raise Exception(f"AutoNLP login failed with return code {autonlp_login.returncode}")
24
 
@@ -38,7 +38,7 @@ with st.form(key="form"):
38
  submit_button = st.form_submit_button("Submit")
39
 
40
  validate_submission(json_data)
41
- user_info = whoami(token)
42
  user_name = user_info["name"]
43
  submission_name = json_data["submission_name"]
44
 
 
8
 
9
  import streamlit as st
10
  from dotenv import load_dotenv
11
+ from huggingface_hub import HfApi, Repository
12
 
13
  from validate import validate_submission
14
 
 
18
  HF_TOKEN = os.getenv("HF_TOKEN")
19
 
20
  # AutoNLP login
21
+ autonlp_login = subprocess.run(["autonlp", "login", "--api-key", HF_TOKEN], stdout=subprocess.PIPE)
22
  if autonlp_login.returncode == -1:
23
  raise Exception(f"AutoNLP login failed with return code {autonlp_login.returncode}")
24
 
 
38
  submit_button = st.form_submit_button("Submit")
39
 
40
  validate_submission(json_data)
41
+ user_info = HfApi().whoami(token)
42
  user_name = user_info["name"]
43
  submission_name = json_data["submission_name"]
44
 
requirements.txt CHANGED
@@ -1,3 +1,2 @@
1
- # huggingface-hub==0.2.1
2
  python-dotenv
3
  autonlp>=0.3.4
 
 
1
  python-dotenv
2
  autonlp>=0.3.4