title: Food Classifier with Model Comparison | |
emoji: π | |
colorFrom: green | |
colorTo: blue | |
sdk: gradio | |
sdk_version: 4.19.2 | |
app_file: app.py | |
pinned: false | |
# π Food Classifier: Accuracy vs. Speed | |
This Gradio demo allows you to classify food images using two different transformer-based models and visually compare their performance. | |
## How to Use | |
1. **Upload an Image**: Drag and drop a food image or click to upload one. You can also use one of the examples below. | |
2. **Choose a Model**: Select either the ViT or Swin model from the dropdown. | |
3. **Click Classify**: The model will predict the food item. | |
## The Comparison Feature | |
The key feature of this demo is the **performance comparison chart**: | |
- **Benchmark Accuracy**: This chart shows the reported accuracy of each model on the Food101 test set. The Swin model is generally more accurate. | |
- **Inference Time**: This chart shows the *actual time* it took for the selected model to process *your* uploaded image. You can see the speed trade-off firsthand. The ViT model is often faster. | |
This allows you to understand the classic machine learning trade-off between a model's accuracy and its computational cost (speed). | |