| | --- |
| | 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 |