aopp
Browse files
app.py
CHANGED
@@ -19,15 +19,12 @@ def predict_text(text):
|
|
19 |
predicted_class_index = prediction['class_index']
|
20 |
predicted_class_label = list(class_label_mapping.keys())[list(class_label_mapping.values()).index(predicted_class_index)]
|
21 |
predicted_class_probability = prediction['probs'][predicted_class_index]
|
22 |
-
return {
|
23 |
|
24 |
iface = gr.Interface(
|
25 |
fn=predict_text,
|
26 |
inputs="text",
|
27 |
-
outputs=
|
28 |
-
gr.outputs.Textbox(label="Label"),
|
29 |
-
gr.outputs.Label(num_top_classes=1, type="confidences", label="Probability")
|
30 |
-
],
|
31 |
title="Food Origin Classification App",
|
32 |
description="Enter a Recipe, and it will predict the class label.",
|
33 |
)
|
|
|
19 |
predicted_class_index = prediction['class_index']
|
20 |
predicted_class_label = list(class_label_mapping.keys())[list(class_label_mapping.values()).index(predicted_class_index)]
|
21 |
predicted_class_probability = prediction['probs'][predicted_class_index]
|
22 |
+
return {predicted_class_label: float(predicted_class_probability)}
|
23 |
|
24 |
iface = gr.Interface(
|
25 |
fn=predict_text,
|
26 |
inputs="text",
|
27 |
+
outputs=gr.outputs.KeyValues(label="Predicted Class and Probability"),
|
|
|
|
|
|
|
28 |
title="Food Origin Classification App",
|
29 |
description="Enter a Recipe, and it will predict the class label.",
|
30 |
)
|