|
--- |
|
title: "AML 16" |
|
version: "1.0.0" |
|
emoji: "🤗" |
|
colorFrom: indigo |
|
colorTo: pink |
|
sdk: gradio |
|
sdk_version: "5.29.0" |
|
app_file: app.py |
|
pinned: false |
|
--- |
|
|
|
# AML 16 |
|
|
|
This is a demo application for the best-performing model (Swin-Large) created for the AML 16 project. |
|
The app uses Gradio to provide an interactive interface where users can upload an image, view the top-1 predicted scene category, see a reference image from the predicted class, and explore the top-5 prediction probabilities in a bar chart. |
|
|
|
The model was trained for scene classification and deployed using Hugging Face Spaces. |
|
|
|
- predict.py |
|
This file handles loading the trained Swin-Large model and making predictions. |
|
It loads the model weights from Hugging Face Hub, applies the correct image preprocessing, and outputs: |
|
|
|
The uploaded image, |
|
|
|
A reference image from the predicted class, |
|
|
|
The Top-5 prediction probabilities. |
|
|
|
The model was customized with an updated classifier head, and class labels are loaded from a labels.json file. A random sample image from the predicted class folder is also shown for better visualization. |
|
|
|
- app.py |
|
This file builds the Gradio interface. |
|
It lets users upload an image, runs the prediction using predict.py, and displays: |
|
|
|
The uploaded image, |
|
|
|
An image for the top-1 predicted class, |
|
|
|
The predicted class label, |
|
|
|
A bar chart showing the Top-5 prediction probabilities. |