aopp
Browse files
    	
        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  | 
| 27 |  | 
| 28 | 
             
            iface = gr.Interface(
         | 
| 29 | 
             
                fn=predict_text,
         | 
| 30 | 
             
                inputs="text",
         | 
| 31 | 
            -
                outputs= | 
| 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 | 
             
            )
         |