Download app.py from erojuns/test2: direct link, hf CLI and curl.
- Browser
- Download file 650 Bytes
-
https://huggingface.co/spaces/erojuns/test2/resolve/main/app.py
- Command line
-
hf download hf://spaces/erojuns/test2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/erojuns/test2/resolve/main/app.py
650 Bytes
| 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) |