sanjid commited on
Commit
67a908d
·
1 Parent(s): 4829bea
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,12 +23,12 @@ def predict_text(text):
23
  predicted_class_index = prediction['class_index']
24
  predicted_class_label = list(class_label_mapping.keys())[list(class_label_mapping.values()).index(predicted_class_index)]
25
  predicted_class_probability = prediction['probs'][predicted_class_index]
26
- return {"label": predicted_class_label, "probability": f"{predicted_class_probability * 100:.2f}%"}
27
 
28
  iface = gr.Interface(
29
  fn=predict_text,
30
  inputs="text",
31
- outputs=gr.outputs.Label(num_top_classes=5),
32
  title="Food Origin Classification App",
33
  description="Enter a Recipe, and it will predict the class label.",
34
  )
 
23
  predicted_class_index = prediction['class_index']
24
  predicted_class_label = list(class_label_mapping.keys())[list(class_label_mapping.values()).index(predicted_class_index)]
25
  predicted_class_probability = prediction['probs'][predicted_class_index]
26
+ return f"Label: {predicted_class_label}, Probability: {predicted_class_probability * 100:.2f}%"
27
 
28
  iface = gr.Interface(
29
  fn=predict_text,
30
  inputs="text",
31
+ outputs="text",
32
  title="Food Origin Classification App",
33
  description="Enter a Recipe, and it will predict the class label.",
34
  )