Delete README.md
Browse files
README.md
DELETED
|
@@ -1,88 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: AI-Powered Image Classification
|
| 3 |
-
emoji: 🖼️
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: static
|
| 7 |
-
app_file: index.html
|
| 8 |
-
pinned: false
|
| 9 |
-
models:
|
| 10 |
-
- Xenova/resnet-18
|
| 11 |
-
- Xenova/vit-base-patch16-224
|
| 12 |
-
- Xenova/clip-vit-base-patch32
|
| 13 |
-
---
|
| 14 |
-
|
| 15 |
-
# AI-Powered Image Classification
|
| 16 |
-
|
| 17 |
-
A small teaching mini-lab for a Creative Technology / introductory AI course.
|
| 18 |
-
|
| 19 |
-
The project shows how a pretrained model can turn image classification into a capability that can be used directly inside an application. Students do not need to train a neural network for the baseline task.
|
| 20 |
-
|
| 21 |
-
## The learning story
|
| 22 |
-
|
| 23 |
-
1. Choose one of eight tested examples (four are shown at random), or upload an image.
|
| 24 |
-
2. Choose a browser-compatible classifier: ResNet-18, ViT-B/16, or CLIP.
|
| 25 |
-
3. Inspect the predicted labels and confidence scores.
|
| 26 |
-
4. Keep the image fixed and switch models to compare decisions.
|
| 27 |
-
5. For CLIP, change the candidate labels and observe how the result changes.
|
| 28 |
-
6. Use the comparison log to discuss changes in the top label, score, and runtime.
|
| 29 |
-
|
| 30 |
-
## Model and data
|
| 31 |
-
|
| 32 |
-
- Recommended classroom default: `Xenova/resnet-18`
|
| 33 |
-
- Comparison models: `Xenova/vit-base-patch16-224`, `Xenova/clip-vit-base-patch32`
|
| 34 |
-
- Task: image classification
|
| 35 |
-
- Fixed label space: ImageNet-1K for ResNet and ViT
|
| 36 |
-
- Flexible label space: user-supplied candidate descriptions for CLIP
|
| 37 |
-
- Example bank: four reusable photographs from the scikit-image sample collection
|
| 38 |
-
|
| 39 |
-
All three models are already trained. This demo performs inference only; no training code or GPU server is required.
|
| 40 |
-
|
| 41 |
-
## One project, one demo
|
| 42 |
-
|
| 43 |
-
- `index.html` — page structure and teaching flow
|
| 44 |
-
- `style.css` — presentation
|
| 45 |
-
- `app.js` — interaction, image handling, and result rendering
|
| 46 |
-
- `classifier.js` — the online Hugging Face model call
|
| 47 |
-
- `examples/` — tested example images
|
| 48 |
-
- `how-to-start.html` / `how-to-start.pdf` — student guide for duplicating, editing, testing, and submitting a Space
|
| 49 |
-
|
| 50 |
-
## Runtime
|
| 51 |
-
|
| 52 |
-
The Space is static. `classifier.js` imports Transformers.js from jsDelivr and creates a pipeline with a Hugging Face model ID. The first run for each model downloads its quantized model files from Hugging Face into the browser cache; later runs can reuse that cache. The selected image is processed in the browser and is not uploaded to an inference server.
|
| 53 |
-
|
| 54 |
-
This is the same online model-loading pattern used by the reference object-detection Space, with the task and models changed to image classification.
|
| 55 |
-
|
| 56 |
-
Reference object-detection Space: <https://huggingface.co/spaces/wr92-course/test>
|
| 57 |
-
|
| 58 |
-
## Student assignment
|
| 59 |
-
|
| 60 |
-
Students can duplicate this Space as a working starting point, then build their own AI mini app. They may extend image classification or adapt the project to a different AI task. A submission should make the app's purpose, input, output, and AI model or service easy to understand and demonstrate at least one working example.
|
| 61 |
-
|
| 62 |
-
In the App tab, select **How to Start** for the browser-based steps to create an account, duplicate the Space, edit files, test, and submit a public Space URL. Students are not required to train an AI model from scratch.
|
| 63 |
-
|
| 64 |
-
Higher-scoring work should deepen the selected AI task: compare or replace models, change label spaces, test another image domain, study failure cases, or improve speed and evaluation.
|
| 65 |
-
|
| 66 |
-
## Classroom check before use
|
| 67 |
-
|
| 68 |
-
Before presenting, verify that:
|
| 69 |
-
|
| 70 |
-
- every image in the eight-example bank can be selected;
|
| 71 |
-
- Shuffle changes the four visible examples drawn from the eight-image bank;
|
| 72 |
-
- an uploaded image can be classified;
|
| 73 |
-
- ResNet-18 and ViT-B/16 return ImageNet labels;
|
| 74 |
-
- CLIP responds to changes in candidate labels;
|
| 75 |
-
- the top-k slider changes the number of displayed predictions;
|
| 76 |
-
- the score bars and comparison log update after every successful run;
|
| 77 |
-
- the first uncached run shows download progress;
|
| 78 |
-
- the page works at a narrow/mobile width.
|
| 79 |
-
|
| 80 |
-
## Local preview
|
| 81 |
-
|
| 82 |
-
Run a local web server in this folder, for example:
|
| 83 |
-
|
| 84 |
-
```bash
|
| 85 |
-
python -m http.server 7860
|
| 86 |
-
```
|
| 87 |
-
|
| 88 |
-
Then open `http://localhost:7860`. Opening `index.html` directly with `file://` may block module loading.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|