erojuns commited on
Commit
34debf8
1 Parent(s): b6559e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -6,15 +6,13 @@ tokenizer = AutoTokenizer.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction"
6
  model = BertForSequenceClassification.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
7
  config = model.config
8
 
9
-
10
-
11
  pipe = pipeline('sentiment-analysis')
12
  text = st.text_area('test')
13
 
14
-
15
- text = "subarachnoid hemorrhage scalp laceration service: surgery major surgical or invasive"
16
- encoded_input = tokenizer(text, return_tensors='pt')
17
- output = model(**encoded_input)
18
-
19
- results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
20
- return [ config.id2label[ids] for ids in results]
 
6
  model = BertForSequenceClassification.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
7
  config = model.config
8
 
 
 
9
  pipe = pipeline('sentiment-analysis')
10
  text = st.text_area('test')
11
 
12
+ if text:
13
+ encoded_input = tokenizer(text, return_tensors='pt')
14
+ output = model(**encoded_input)
15
+
16
+ results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
17
+ vara= [ config.id2label[ids] for ids in results]
18
+ st.write(vara)