Madhuslista commited on
Commit
d3e47d3
1 Parent(s): 91ab7d8

Feature: Add login to CLI wrapper

Browse files
Files changed (2) hide show
  1. .gitignore +1 -0
  2. hf_cli.sh +21 -0
.gitignore CHANGED
@@ -1 +1,2 @@
1
  .venv
 
 
1
  .venv
2
+ .env
hf_cli.sh CHANGED
@@ -1,7 +1,28 @@
1
  #!/usr/bin/zsh
2
  # -*- coding: utf-8 -*-
3
 
 
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # -->> Tunables <<---------------------
6
 
7
 
 
1
  #!/usr/bin/zsh
2
  # -*- coding: utf-8 -*-
3
 
4
+ # Get parent directory absolute path
5
+ REPO_DIR="$(pwd)"
6
 
7
+
8
+ # Check if .venv is active, if not activate it
9
+ if [[ -z $VIRTUAL_ENV ]]; then
10
+ source .venv/bin/activate
11
+ fi
12
+
13
+
14
+ # Login:
15
+ USER=$(huggingface-cli whoami)
16
+ if [[ $USER == "Not logged in" ]]; then
17
+
18
+ #Get .env variables
19
+ set -o allexport
20
+ source .env
21
+ set +o allexport
22
+
23
+ echo "Not logged in"
24
+ huggingface-cli login --token $TOKEN
25
+ fi
26
  # -->> Tunables <<---------------------
27
 
28