Spaces:
Running
Running
meghanaraok
commited on
Commit
•
7b42cef
1
Parent(s):
e171206
Update app.py
Browse files
app.py
CHANGED
@@ -96,7 +96,7 @@ def predict_icd(text_input, model_name, label_count):
|
|
96 |
|
97 |
model_path = "meghanaraok/"+model_name+"_"+label_count+"/"
|
98 |
#change
|
99 |
-
label_dict = pd.read_csv("data/mimic3"+label_count+"/labels_dictionary_"+label_count+"_level_1.csv")
|
100 |
num_labels = label_dict.shape[0]
|
101 |
|
102 |
if model_name != "ClinicalLongformer":
|
@@ -104,17 +104,13 @@ def predict_icd(text_input, model_name, label_count):
|
|
104 |
parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments))
|
105 |
model_args, data_args, training_args = parser.parse_json_file(json_file=config_json)
|
106 |
coding_model_config, model_class = get_coding_model_config(model_name, model_args, data_args, label_dict, label_dict.shape[0])
|
107 |
-
#2
|
108 |
kwargs = {
|
109 |
"coding_model_config": coding_model_config,
|
110 |
"args": training_args
|
111 |
}
|
112 |
-
#3
|
113 |
model = model_class.from_pretrained(model_path, **kwargs)
|
114 |
model.to(torch.device("cuda:0"))
|
115 |
-
#4
|
116 |
tokenizer = AutoTokenizer.from_pretrained(model_args.tokenizer_name, padding_side="right")
|
117 |
-
#4
|
118 |
results = segment_tokenize_dataset(tokenizer, text, labels,
|
119 |
data_args.max_seq_length,
|
120 |
model_args.num_chunks_per_document)
|
|
|
96 |
|
97 |
model_path = "meghanaraok/"+model_name+"_"+label_count+"/"
|
98 |
#change
|
99 |
+
label_dict = pd.read_csv("../data/mimic3"+label_count+"/labels_dictionary_"+label_count+"_level_1.csv")
|
100 |
num_labels = label_dict.shape[0]
|
101 |
|
102 |
if model_name != "ClinicalLongformer":
|
|
|
104 |
parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments))
|
105 |
model_args, data_args, training_args = parser.parse_json_file(json_file=config_json)
|
106 |
coding_model_config, model_class = get_coding_model_config(model_name, model_args, data_args, label_dict, label_dict.shape[0])
|
|
|
107 |
kwargs = {
|
108 |
"coding_model_config": coding_model_config,
|
109 |
"args": training_args
|
110 |
}
|
|
|
111 |
model = model_class.from_pretrained(model_path, **kwargs)
|
112 |
model.to(torch.device("cuda:0"))
|
|
|
113 |
tokenizer = AutoTokenizer.from_pretrained(model_args.tokenizer_name, padding_side="right")
|
|
|
114 |
results = segment_tokenize_dataset(tokenizer, text, labels,
|
115 |
data_args.max_seq_length,
|
116 |
model_args.num_chunks_per_document)
|