Pendrokar commited on
Commit
ef93563
β€’
1 Parent(s): 8e17b76

get commit without using deprecated code

Browse files
app.py CHANGED
@@ -5,16 +5,17 @@ import requests
5
  import json
6
  from subprocess import Popen, PIPE
7
  import threading
8
- from huggingface_hub import Repository
9
  import gradio as gr
10
 
11
- # start xVASynth server (no HTTP)
12
- # import resources.app.no_server as xvaserver
13
 
14
  # model
15
  hf_model_name = "Pendrokar/xvapitch_nvidia"
16
- model_repo = Repository(local_dir=hf_model_name)
17
- latest_commit_sha = model_repo.git_head_hash()
 
18
  hf_cache_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvapitch_nvidia/snapshots/{latest_commit_sha}/'
19
  models_path = hf_cache_models_path
20
 
 
5
  import json
6
  from subprocess import Popen, PIPE
7
  import threading
8
+ from huggingface_hub import HfApi
9
  import gradio as gr
10
 
11
+ # start xVASynth service (no HTTP)
12
+ import resources.app.no_server as xvaserver
13
 
14
  # model
15
  hf_model_name = "Pendrokar/xvapitch_nvidia"
16
+ model_repo = HfApi()
17
+ commits = model_repo.list_repo_commits(repo_id=hf_model_name)
18
+ latest_commit_sha = commits[0].commit_id
19
  hf_cache_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvapitch_nvidia/snapshots/{latest_commit_sha}/'
20
  models_path = hf_cache_models_path
21
 
resources/app/plugins/deepmoji_plugin/DeepMoji/torchmoji/global_variables.py CHANGED
@@ -3,6 +3,11 @@
3
  """
4
  import tempfile
5
  from os.path import abspath, dirname
 
 
 
 
 
6
 
7
  # The ordering of these special tokens matter
8
  # blank tokens can be used for new purposes
@@ -16,8 +21,8 @@ SPECIAL_TOKENS = ['CUSTOM_MASK',
16
  'CUSTOM_BREAK']
17
  SPECIAL_TOKENS.extend(['{}BLANK_{}'.format(SPECIAL_PREFIX, i) for i in range(6, 10)])
18
 
19
- VOCAB_PATH = '/home/user/.cache/huggingface/hub/models--Pendrokar--TorchMoji/snapshots/58217568daaf64d3621245dd5c88c94e651a08d6/vocabulary.json'
20
- PRETRAINED_PATH = '/home/user/.cache/huggingface/hub/models--Pendrokar--TorchMoji/snapshots/58217568daaf64d3621245dd5c88c94e651a08d6/pytorch_model.bin'
21
  # ROOT_PATH = dirname(dirname(abspath(__file__)))
22
  # VOCAB_PATH = '{}/model/vocabulary.json'.format(ROOT_PATH)
23
  # PRETRAINED_PATH = '{}/model/pytorch_model.bin'.format(ROOT_PATH)
 
3
  """
4
  import tempfile
5
  from os.path import abspath, dirname
6
+ from huggingface_hub import HfApi
7
+
8
+ api = HfApi()
9
+ commits = api.list_repo_commits(repo_id=hf_model_name)
10
+ latest_commit_sha = commits[0].commit_id
11
 
12
  # The ordering of these special tokens matter
13
  # blank tokens can be used for new purposes
 
21
  'CUSTOM_BREAK']
22
  SPECIAL_TOKENS.extend(['{}BLANK_{}'.format(SPECIAL_PREFIX, i) for i in range(6, 10)])
23
 
24
+ VOCAB_PATH = f'/home/user/.cache/huggingface/hub/models--Pendrokar--TorchMoji/snapshots/{latest_commit_sha}/vocabulary.json'
25
+ PRETRAINED_PATH = f'/home/user/.cache/huggingface/hub/models--Pendrokar--TorchMoji/snapshots/{latest_commit_sha}/pytorch_model.bin'
26
  # ROOT_PATH = dirname(dirname(abspath(__file__)))
27
  # VOCAB_PATH = '{}/model/vocabulary.json'.format(ROOT_PATH)
28
  # PRETRAINED_PATH = '{}/model/pytorch_model.bin'.format(ROOT_PATH)