Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,8 @@
|
|
1 |
-
import gradio as gr
|
2 |
import torch
|
3 |
-
import gradio as gr
|
4 |
from transformers import AutoTokenizer, BertForSequenceClassification
|
5 |
|
6 |
-
|
7 |
-
model = BertForSequenceClassification.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
|
8 |
-
config = model.config
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
output = model(**encoded_input)
|
13 |
-
results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
|
14 |
-
return [ config.id2label[ids] for ids in results]
|
15 |
-
#return tokenizer.decode(output[0][0].argmax(dim=-1))
|
16 |
|
17 |
-
demo = gr.Interface(fn=prompt,inputs= "text", outputs="text")
|
18 |
-
demo.launch(debug=True)
|
|
|
|
|
1 |
import torch
|
|
|
2 |
from transformers import AutoTokenizer, BertForSequenceClassification
|
3 |
|
4 |
+
import gradio as gr
|
|
|
|
|
5 |
|
6 |
+
gr.Interface.load("models/AkshatSurolia/ICD-10-Code-Prediction",inputs="text", outputs="text"
|
7 |
+
title="ICD 10 Code Prediction", description="type in a disease and it will predict its ICD-10 codes").launch(debug=True)
|
|
|
|
|
|
|
|
|
8 |
|
|
|
|