Update app.py
Browse files
app.py
CHANGED
@@ -7,25 +7,23 @@ from service_dops_api.dops_config import ServiceDopsConfig
|
|
7 |
from service_dops_api.dops_classifier import DopsClassifier
|
8 |
import json
|
9 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
10 |
-
tokenizer_cat = BertTokenizer.from_pretrained("
|
11 |
token=HF_TOKEN)
|
12 |
-
model_cat = BertForSequenceClassification.from_pretrained('
|
13 |
|
14 |
clf_cat = pipeline("text-classification", model=model_cat, tokenizer=tokenizer_cat)
|
15 |
|
16 |
-
id2label_cat = pd.read_pickle('id2label_service_categoriser.pickle')
|
17 |
|
18 |
-
tokenizer_spec = BertTokenizer.from_pretrained("
|
19 |
token=HF_TOKEN)
|
20 |
-
model_spec = BertForSequenceClassification.from_pretrained('
|
21 |
|
22 |
clf_spec = pipeline("text-classification", model=model_spec, tokenizer=tokenizer_spec)
|
23 |
|
24 |
id2label_spec = pd.read_pickle('id2label_spec_categoriser.pickle')
|
25 |
def categoriser_predict(input_text):
|
26 |
predictions = clf_cat(input_text)
|
27 |
-
|
28 |
-
text_label = id2label_cat[numeric_label]
|
29 |
return text_label
|
30 |
def doctor_spec_predict(input_text):
|
31 |
predictions = clf_spec(input_text)
|
|
|
7 |
from service_dops_api.dops_classifier import DopsClassifier
|
8 |
import json
|
9 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
10 |
+
tokenizer_cat = BertTokenizer.from_pretrained("etadevosyan/service_categorizer_v2",
|
11 |
token=HF_TOKEN)
|
12 |
+
model_cat = BertForSequenceClassification.from_pretrained('etadevosyan/service_categorizer_v2',token=HF_TOKEN)
|
13 |
|
14 |
clf_cat = pipeline("text-classification", model=model_cat, tokenizer=tokenizer_cat)
|
15 |
|
|
|
16 |
|
17 |
+
tokenizer_spec = BertTokenizer.from_pretrained("etadevosyan/specialists_categorizer_model",
|
18 |
token=HF_TOKEN)
|
19 |
+
model_spec = BertForSequenceClassification.from_pretrained('etadevosyan/specialists_categorizer_model',token=HF_TOKEN)
|
20 |
|
21 |
clf_spec = pipeline("text-classification", model=model_spec, tokenizer=tokenizer_spec)
|
22 |
|
23 |
id2label_spec = pd.read_pickle('id2label_spec_categoriser.pickle')
|
24 |
def categoriser_predict(input_text):
|
25 |
predictions = clf_cat(input_text)
|
26 |
+
text_label = predictions[0]['label']
|
|
|
27 |
return text_label
|
28 |
def doctor_spec_predict(input_text):
|
29 |
predictions = clf_spec(input_text)
|