Dunateo
commited on
Commit
·
d11d1ee
1
Parent(s):
744d0b7
fix pb with label dict
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ from huggingface_hub import hf_hub_download
|
|
4 |
import torch
|
5 |
import json
|
6 |
|
|
|
|
|
7 |
def predict(text):
|
8 |
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
|
9 |
|
@@ -23,6 +25,8 @@ if __name__ == '__main__':
|
|
23 |
|
24 |
# get the dict file
|
25 |
label_dict_file = hf_hub_download(repo_id=model_path, filename="label_dict.json")
|
|
|
|
|
26 |
with open(label_dict_file, "r") as f:
|
27 |
label_dict = json.load(f)
|
28 |
|
|
|
4 |
import torch
|
5 |
import json
|
6 |
|
7 |
+
label_dict = ''
|
8 |
+
|
9 |
def predict(text):
|
10 |
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
|
11 |
|
|
|
25 |
|
26 |
# get the dict file
|
27 |
label_dict_file = hf_hub_download(repo_id=model_path, filename="label_dict.json")
|
28 |
+
|
29 |
+
global label_dict
|
30 |
with open(label_dict_file, "r") as f:
|
31 |
label_dict = json.load(f)
|
32 |
|