owaiskha9654
commited on
Commit
β’
3f66889
1
Parent(s):
28ee649
Update app.py
Browse files
app.py
CHANGED
@@ -8,8 +8,8 @@ from typing import Dict
|
|
8 |
|
9 |
|
10 |
num_labels=14
|
11 |
-
|
12 |
-
|
13 |
|
14 |
|
15 |
def Multi_Label_Classification_of_Pubmed_Articles(model_input: str) -> Dict[str, float]:
|
@@ -20,7 +20,6 @@ def Multi_Label_Classification_of_Pubmed_Articles(model_input: str) -> Dict[str,
|
|
20 |
b_logit_pred = outs[0]
|
21 |
pred_label = torch.sigmoid(b_logit_pred)
|
22 |
|
23 |
-
#prediction = model.predict(tokenized)[0]
|
24 |
ret ={
|
25 |
"Anatomy [A]": float(pred_label[0][0]),
|
26 |
"Organisms [B]": float(pred_label[0][1]),
|
@@ -36,11 +35,7 @@ def Multi_Label_Classification_of_Pubmed_Articles(model_input: str) -> Dict[str,
|
|
36 |
"Named Groups [M]": float(pred_label[0][11]),
|
37 |
"Health Care [N]": float(pred_label[0][12]),
|
38 |
"Geographicals [Z]": float(pred_label[0][13])}
|
39 |
-
|
40 |
-
# "negative": float(prediction[0]),
|
41 |
-
# "positive": float(prediction[1])
|
42 |
-
#}
|
43 |
-
return pred_labels
|
44 |
|
45 |
|
46 |
model_input = gr.Textbox("Input text here", show_label=False)
|
|
|
8 |
|
9 |
|
10 |
num_labels=14
|
11 |
+
model = BertForSequenceClassification.from_pretrained("owaiskha9654/Multi-Label-Classification-of-PubMed-Articles", num_labels=num_labels)
|
12 |
+
tokenizer = BertTokenizer.from_pretrained('owaiskha9654/Multi-Label-Classification-of-PubMed-Articles', do_lower_case=True)
|
13 |
|
14 |
|
15 |
def Multi_Label_Classification_of_Pubmed_Articles(model_input: str) -> Dict[str, float]:
|
|
|
20 |
b_logit_pred = outs[0]
|
21 |
pred_label = torch.sigmoid(b_logit_pred)
|
22 |
|
|
|
23 |
ret ={
|
24 |
"Anatomy [A]": float(pred_label[0][0]),
|
25 |
"Organisms [B]": float(pred_label[0][1]),
|
|
|
35 |
"Named Groups [M]": float(pred_label[0][11]),
|
36 |
"Health Care [N]": float(pred_label[0][12]),
|
37 |
"Geographicals [Z]": float(pred_label[0][13])}
|
38 |
+
return ret
|
|
|
|
|
|
|
|
|
39 |
|
40 |
|
41 |
model_input = gr.Textbox("Input text here", show_label=False)
|