Spaces:
Running
Running
HF_HUB_CACHE environ
Browse files
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 = "
|
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):
|