Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,11 @@
|
|
|
|
1 |
from transformers import AutoTokenizer, BertForSequenceClassification
|
2 |
tokenizer = AutoTokenizer.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
|
3 |
model = BertForSequenceClassification.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
|
4 |
config = model.config
|
5 |
|
6 |
-
text =
|
|
|
7 |
encoded_input = tokenizer(text, return_tensors='pt')
|
8 |
output = model(**encoded_input)
|
9 |
|
@@ -11,8 +13,8 @@ results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
|
|
11 |
#return [ config.id2label[ids] for ids in results]
|
12 |
|
13 |
#pipe = pipeline('sentiment-analysis')
|
14 |
-
#text = st.text_area('enter some text!')
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
1 |
+
import strimlit as st
|
2 |
from transformers import AutoTokenizer, BertForSequenceClassification
|
3 |
tokenizer = AutoTokenizer.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
|
4 |
model = BertForSequenceClassification.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
|
5 |
config = model.config
|
6 |
|
7 |
+
text = st.text_area('enter some text!')
|
8 |
+
#text = "subarachnoid hemorrhage scalp laceration service: surgery major surgical or invasive"
|
9 |
encoded_input = tokenizer(text, return_tensors='pt')
|
10 |
output = model(**encoded_input)
|
11 |
|
|
|
13 |
#return [ config.id2label[ids] for ids in results]
|
14 |
|
15 |
#pipe = pipeline('sentiment-analysis')
|
|
|
16 |
|
17 |
+
|
18 |
+
if text:
|
19 |
+
out = pipe(text)
|
20 |
+
st.json('{}')
|