nijatzeynalov commited on
Commit
c2d8651
·
1 Parent(s): 05dc8d3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -0
README.md CHANGED
@@ -23,3 +23,48 @@ I will also provide dataset which can be used in Azerbaijani medical QA and rela
23
 
24
  # How to use
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  # How to use
25
 
26
+ Here is how to use this model.
27
+
28
+ __Firstly, you need to build a dictionary with medical branch names and their numbers, because target is encoded and model output will be a number.__
29
+
30
+ ```python
31
+ branch_dict = {0: 'Endoskopist', 1: 'Nevropatoloq',2: 'Dermato veneroloq',3: 'Qastroenteroloq',
32
+ 4: 'Psixoloq', 5: 'Pediatr', 6: 'Proktoloq', 7: 'Endokrinoloq',
33
+ 8: 'Psixoterapevt', 9: 'Allerqoloq', 10: 'Oftalmoloq', 11: 'Kardioloq', 12: 'Uroloq',
34
+ 13: 'Plastik cərrah', 14: 'Cərrah-proktoloq', 15: 'Ümumi cərrah',
35
+ 16: 'Hepatoloq', 17: 'LOR həkimi', 18: 'Ginekoloq'}
36
+ ```
37
+
38
+ __Secondly, we will use a simple Python function in order to convert model result to branch name.__
39
+
40
+ ```python
41
+ def result_helper_funct(model_result):
42
+
43
+ result = model_result[0][0]
44
+ if result in branch_dict.keys():
45
+ return branch_dict[result]
46
+ ```
47
+
48
+ __Then, we need to install simpletransformers library__
49
+
50
+ ```python
51
+ !pip install simpletransformers
52
+ ```
53
+ __After succesfully installing, use pre-trained model.__
54
+
55
+ ```python
56
+ from simpletransformers.classification import ClassificationModel
57
+ model = ClassificationModel("bert", "nijatzeynalov/azerbaijani-medical-question-classification", use_cuda=False)
58
+ ```
59
+
60
+ __ At the next step, we just write down the text we want to classify and use our helper function.__
61
+
62
+ ```python
63
+ sample_text = 'salam menim qulagimda agri var'
64
+ result = model.predict([sample_text])
65
+
66
+ result_helper_funct(result)
67
+
68
+ 'LOR həkimi'
69
+
70
+ ```