Rodrigo Uribe
commited on
Commit
•
674d60f
1
Parent(s):
7bfd230
changed outputs
Browse files
app.py
CHANGED
@@ -23,8 +23,12 @@ def classify_text(text):
|
|
23 |
# Convert the index to label
|
24 |
label = "ham" if prediction_index == 0 else "spam"
|
25 |
|
26 |
-
#
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
|
29 |
# Create the Gradio interface
|
30 |
iface = gr.Interface(
|
|
|
23 |
# Convert the index to label
|
24 |
label = "ham" if prediction_index == 0 else "spam"
|
25 |
|
26 |
+
# Get the probabilities of each class
|
27 |
+
ham_prob = probabilities[0][0].numpy()
|
28 |
+
spam_prob = probabilities[0][1].numpy()
|
29 |
+
|
30 |
+
# Return the label and the probabilities separately
|
31 |
+
return label, {"ham": ham_prob, "spam": spam_prob}
|
32 |
|
33 |
# Create the Gradio interface
|
34 |
iface = gr.Interface(
|