Spaces:
Runtime error
Runtime error
File size: 900 Bytes
cc425fb 0453d4c a4ca8d8 83a7ee5 37d7ae1 d6d5e5b 0927c15 6d1b056 a4ca8d8 6d1b056 0715a41 4b33dc3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import streamlit as st
import logging
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
from googletrans import Translator
translator = Translator()
translated = translator.translate('Бороди́нское сраже́ние')
print(translated.text)
text = st.text_area('enter some text!')
#text = "subarachnoid hemorrhage scalp laceration service: surgery major surgical or invasive"
#pipe = pipeline('sentiment-analysis')
if text:
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
rout = [ config.id2label[ids] for ids in results]
st.write(rout) |