File size: 650 Bytes
63a51e3 fb6a573 b6559e1 fb6a573 dd2eccf fb6a573 34debf8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import streamlit as st
from transformers import pipeline
from transformers import AutoTokenizer, BertForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
model = BertForSequenceClassification.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
config = model.config
pipe = pipeline('sentiment-analysis')
text = st.text_area('test')
if text:
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
vara= [ config.id2label[ids] for ids in results]
st.write(vara) |