Update app.py
Browse files
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 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
| 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)
|