Pendrokar commited on
Commit
afabdf2
·
1 Parent(s): 8ff845b

HF_HUB_CACHE environ

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -3,6 +3,7 @@ from __future__ import print_function, division, unicode_literals
3
  import gradio as gr
4
 
5
  import sys
 
6
  from os.path import abspath, dirname
7
 
8
  import json
@@ -14,7 +15,7 @@ from transformers import AutoModel, AutoTokenizer
14
  model_name = "Pendrokar/TorchMoji"
15
  model = AutoModel.from_pretrained(model_name)
16
  tokenizer = AutoTokenizer.from_pretrained(model_name)
17
- model_path = "~/.cache/huggingface/hub/pytorch_model.bin"
18
  vocab_path = './' + model_name + "/vocabulary.json"
19
 
20
  def top_elements(array, k):
 
3
  import gradio as gr
4
 
5
  import sys
6
+ from os import environ
7
  from os.path import abspath, dirname
8
 
9
  import json
 
15
  model_name = "Pendrokar/TorchMoji"
16
  model = AutoModel.from_pretrained(model_name)
17
  tokenizer = AutoTokenizer.from_pretrained(model_name)
18
+ model_path = environ['HF_HUB_CACHE'] + "{model_name}/pytorch_model.bin"
19
  vocab_path = './' + model_name + "/vocabulary.json"
20
 
21
  def top_elements(array, k):