Spaces:
Running
Running
vkovacs
commited on
Commit
·
fb347fa
1
Parent(s):
f61fe0b
making it prettier
Browse files
app.py
CHANGED
@@ -56,7 +56,7 @@ def predict(text, model_id, tokenizer_id):
|
|
56 |
|
57 |
probs = torch.nn.functional.softmax(logits, dim=1).cpu().numpy().flatten()
|
58 |
label_pred = model.config.id2label[probs.argmax()]
|
59 |
-
probability_pred = f"{100*probs.max()}%"
|
60 |
return label_pred, probability_pred
|
61 |
|
62 |
|
@@ -83,8 +83,7 @@ with gr.Blocks() as demo:
|
|
83 |
predict_button = gr.Button("Submit")
|
84 |
|
85 |
with gr.Column():
|
86 |
-
result_table = gr.Dataframe(headers=["Sentence", "Prediction", "
|
87 |
-
label="Sentence-level Predictions")
|
88 |
model_info = gr.Markdown()
|
89 |
|
90 |
predict_button.click(
|
|
|
56 |
|
57 |
probs = torch.nn.functional.softmax(logits, dim=1).cpu().numpy().flatten()
|
58 |
label_pred = model.config.id2label[probs.argmax()]
|
59 |
+
probability_pred = f"{round(100*probs.max(), 2)}%"
|
60 |
return label_pred, probability_pred
|
61 |
|
62 |
|
|
|
83 |
predict_button = gr.Button("Submit")
|
84 |
|
85 |
with gr.Column():
|
86 |
+
result_table = gr.Dataframe(headers=["Sentence", "Prediction", "Confidence"])
|
|
|
87 |
model_info = gr.Markdown()
|
88 |
|
89 |
predict_button.click(
|