File size: 1,380 Bytes
c4c51e5
4492f83
 
 
 
 
c4c51e5
4492f83
c4c51e5
 
 
 
4492f83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
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.