Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,20 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
pipe = pipeline('sentiment-analysis')
|
6 |
text = st.text_area('test')
|
7 |
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
from transformers import AutoTokenizer, BertForSequenceClassification
|
5 |
+
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]
|