Commit
·
41d6954
1
Parent(s):
7f756fb
Secret token
Browse files
app.py
CHANGED
@@ -6,11 +6,10 @@ from dotenv import dotenv_values
|
|
6 |
import pandas as pd
|
7 |
from service_dops_api.dops_config import ServiceDopsConfig
|
8 |
from service_dops_api.dops_classifier import DopsClassifier
|
9 |
-
hf_token = dotenv_values('.env')['HF_TOKEN']
|
10 |
def categoriser_predict(input_text):
|
11 |
tokenizer = BertTokenizer.from_pretrained("warleagle/service_name_categorizer",
|
12 |
-
token=
|
13 |
-
model = BertForSequenceClassification.from_pretrained('warleagle/service_name_categorizer',token=
|
14 |
clf = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
15 |
predictions = clf(input_text)
|
16 |
numeric_label = int(predictions[0]['label'].split("_")[1])
|
@@ -19,8 +18,8 @@ def categoriser_predict(input_text):
|
|
19 |
return text_label
|
20 |
def doctor_spec_predict(input_text):
|
21 |
tokenizer = BertTokenizer.from_pretrained("warleagle/specialists_categorizer_model",
|
22 |
-
token=
|
23 |
-
model = BertForSequenceClassification.from_pretrained('warleagle/specialists_categorizer_model',token=
|
24 |
clf = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
25 |
predictions = clf(input_text)
|
26 |
numeric_label = int(predictions[0]['label'].split("_")[1])
|
@@ -43,7 +42,11 @@ def service_pipeline(input_text):
|
|
43 |
demo = gr.Interface(fn=service_pipeline,inputs=gr.components.Textbox(label='Название услуги'),
|
44 |
outputs=[gr.components.Textbox(label='Относится ли данная услуга к приёму специалиста'),
|
45 |
gr.components.Textbox(label='Специальность врача'),
|
46 |
-
gr.components.Textbox(label='Дополнительные параметры услуги')]
|
|
|
|
|
|
|
|
|
47 |
|
48 |
if __name__ == "__main__":
|
49 |
demo.launch()
|
|
|
6 |
import pandas as pd
|
7 |
from service_dops_api.dops_config import ServiceDopsConfig
|
8 |
from service_dops_api.dops_classifier import DopsClassifier
|
|
|
9 |
def categoriser_predict(input_text):
|
10 |
tokenizer = BertTokenizer.from_pretrained("warleagle/service_name_categorizer",
|
11 |
+
token=HF_TOKEN)
|
12 |
+
model = BertForSequenceClassification.from_pretrained('warleagle/service_name_categorizer',token=HF_TOKEN)
|
13 |
clf = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
14 |
predictions = clf(input_text)
|
15 |
numeric_label = int(predictions[0]['label'].split("_")[1])
|
|
|
18 |
return text_label
|
19 |
def doctor_spec_predict(input_text):
|
20 |
tokenizer = BertTokenizer.from_pretrained("warleagle/specialists_categorizer_model",
|
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])
|
|
|
42 |
demo = gr.Interface(fn=service_pipeline,inputs=gr.components.Textbox(label='Название услуги'),
|
43 |
outputs=[gr.components.Textbox(label='Относится ли данная услуга к приёму специалиста'),
|
44 |
gr.components.Textbox(label='Специальность врача'),
|
45 |
+
gr.components.Textbox(label='Дополнительные параметры услуги')],
|
46 |
+
examples=[
|
47 |
+
['Врач-офтальмолог (высшая категория/кандидат медицинских наук), первичный приём'],
|
48 |
+
['Прием (осмотр, консультация) - врача -оториноларинголога Первичный, рекомендации'],
|
49 |
+
['Прием врача специалиста ЛОР']])
|
50 |
|
51 |
if __name__ == "__main__":
|
52 |
demo.launch()
|