File size: 1,786 Bytes
f8ae9bd
1f6a2dc
 
 
 
f8ae9bd
1f6a2dc
f8ae9bd
 
1f6a2dc
f8ae9bd
 
1f6a2dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
---
title: MobileCLIP Image Classifier
emoji: 📸
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: mit
---

# 📸 MobileCLIP-B Image Classifier

Interactive web interface for Apple's MobileCLIP-B zero-shot image classification model.

## Features

- 🖼️ **Image Classification**: Upload any image for instant classification
- 🏷️ **Dynamic Labels**: Add and manage classification labels on-the-fly
- 📊 **Visual Results**: See confidence scores with interactive charts
-**Fast Inference**: Optimized for < 30ms latency on GPU
- 🔒 **Admin Panel**: Secure label management interface

## Environment Variables

Configure these in your Space Settings (Settings → Variables and secrets):

| Variable | Description | Required |
|----------|-------------|----------|
| `ADMIN_TOKEN` | Secret token for admin operations | Yes (for admin features) |
| `HF_LABEL_REPO` | Hub dataset repo for label storage (e.g., `username/mobileclip-labels`) | No |
| `HF_WRITE_TOKEN` | Hugging Face token with write permissions | No |
| `HF_READ_TOKEN` | Hugging Face token with read permissions | No |

## How It Works

1. **Model**: Uses MobileCLIP-B with re-parameterized MobileOne blocks for efficient inference
2. **Labels**: Loads from `items.json` or dynamically from Hub repository
3. **Processing**: Pre-computes text embeddings for fast classification
4. **Interface**: Gradio provides the web UI with image upload and admin controls

## Admin Features

With proper authentication, admins can:
- Add new classification labels without redeploying
- Reload specific label versions from the Hub
- View current statistics and label information

## License

- Model weights: Apple Sample Code License (ASCL)
- Interface code: MIT