Commit
·
64aec53
1
Parent(s):
6802ee4
Models usage edited
Browse files
app.py
CHANGED
@@ -6,21 +6,22 @@ import pandas as pd
|
|
6 |
from service_dops_api.dops_config import ServiceDopsConfig
|
7 |
from service_dops_api.dops_classifier import DopsClassifier
|
8 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
token=HF_TOKEN)
|
12 |
-
|
13 |
-
|
|
|
14 |
predictions = clf(input_text)
|
15 |
numeric_label = int(predictions[0]['label'].split("_")[1])
|
16 |
id2label = pd.read_pickle('id2label_service_categoriser.pickle')
|
17 |
text_label = id2label[numeric_label]
|
18 |
return text_label
|
19 |
def doctor_spec_predict(input_text):
|
20 |
-
|
21 |
-
token=HF_TOKEN)
|
22 |
-
model = BertForSequenceClassification.from_pretrained('warleagle/specialists_categorizer_model',token=HF_TOKEN)
|
23 |
-
clf = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
24 |
predictions = clf(input_text)
|
25 |
numeric_label = int(predictions[0]['label'].split("_")[1])
|
26 |
id2label = pd.read_pickle('id2label_spec_categoriser.pickle')
|
|
|
6 |
from service_dops_api.dops_config import ServiceDopsConfig
|
7 |
from service_dops_api.dops_classifier import DopsClassifier
|
8 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
9 |
+
tokenizer_cat = BertTokenizer.from_pretrained("warleagle/service_name_categorizer",
|
10 |
+
token=HF_TOKEN)
|
11 |
+
model_cat = BertForSequenceClassification.from_pretrained('warleagle/service_name_categorizer',token=HF_TOKEN)
|
12 |
+
|
13 |
+
tokenizer_spec = BertTokenizer.from_pretrained("warleagle/specialists_categorizer_model",
|
14 |
token=HF_TOKEN)
|
15 |
+
model_spec = BertForSequenceClassification.from_pretrained('warleagle/specialists_categorizer_model',token=HF_TOKEN)
|
16 |
+
def categoriser_predict(input_text):
|
17 |
+
clf = pipeline("text-classification", model=model_cat, tokenizer=tokenizer_cat)
|
18 |
predictions = clf(input_text)
|
19 |
numeric_label = int(predictions[0]['label'].split("_")[1])
|
20 |
id2label = pd.read_pickle('id2label_service_categoriser.pickle')
|
21 |
text_label = id2label[numeric_label]
|
22 |
return text_label
|
23 |
def doctor_spec_predict(input_text):
|
24 |
+
clf = pipeline("text-classification", model=model_spec, tokenizer=tokenizer_spec)
|
|
|
|
|
|
|
25 |
predictions = clf(input_text)
|
26 |
numeric_label = int(predictions[0]['label'].split("_")[1])
|
27 |
id2label = pd.read_pickle('id2label_spec_categoriser.pickle')
|