Spaces:
Running
on
Zero
Running
on
Zero
File size: 10,237 Bytes
d5b2cea 23d4aef d5b2cea 23d4aef |
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
---
title: L Operator Demo
emoji: π
colorFrom: purple
colorTo: green
sdk: gradio
sdk_version: 5.44.0
app_file: app.py
pinned: true
license: gpl
short_description: demo of l-operator with no commands
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# π€ L-Operator: Android Device Control Demo
A complete multimodal Gradio demo for the [L-Operator model](https://huggingface.co/Tonic/l-android-control), a fine-tuned multimodal AI agent based on LiquidAI's LFM2-VL-1.6B model, optimized for Android device control through visual understanding and action generation.
## π Features
- **Multimodal Interface**: Upload Android screenshots and provide text instructions
- **Chat Interface**: Interactive chat with the model using Gradio's ChatInterface component
- **Action Generation**: Generate JSON actions for Android device control
- **Example Episodes**: Pre-loaded examples from extracted training episodes
- **Real-time Processing**: Optimized for real-time inference
- **Beautiful UI**: Modern, responsive interface with comprehensive documentation
- **β‘ ZeroGPU Compatible**: Dynamic GPU allocation for cost-effective deployment
## π Model Details
| Property | Value |
|----------|-------|
| **Base Model** | [LiquidAI/LFM2-VL-1.6B](https://huggingface.co/LiquidAI/LFM2-VL-1.6B) |
| **Architecture** | LFM2-VL (1.6B parameters) |
| **Fine-tuning** | LoRA (Low-Rank Adaptation) |
| **Training Data** | Android control episodes with screenshots and actions |
| **License** | Proprietary (Investment Access Required) |
## π Quick Start
### Prerequisites
1. **Python 3.8+**: Ensure you have Python 3.8 or higher installed
2. **Hugging Face Access**: Request access to the [L-Operator model](https://huggingface.co/Tonic/l-android-control)
3. **Authentication**: Login to Hugging Face using `huggingface-cli login`
### Installation
1. **Clone the repository**:
```bash
git clone <repository-url>
cd l-operator-demo
```
2. **Install dependencies**:
```bash
pip install -r requirements.txt
```
3. **Authenticate with Hugging Face**:
```bash
huggingface-cli login
```
### Running the Demo
1. **Start the demo**:
```bash
python app.py
```
2. **Open your browser** and navigate to `http://localhost:7860`
3. **Load the model** by clicking the "π Load L-Operator Model" button
4. **Upload an Android screenshot** and provide instructions
5. **Generate actions** or use the chat interface
## β‘ ZeroGPU Deployment
This demo is optimized for [Hugging Face Spaces ZeroGPU](https://huggingface.co/docs/hub/spaces-zerogpu), providing dynamic GPU allocation for cost-effective deployment.
### ZeroGPU Features
- **π Free GPU Access**: Dynamic NVIDIA H200 GPU allocation
- **β‘ On-Demand Resources**: GPUs allocated only when needed
- **π° Cost Efficient**: Optimized resource utilization
- **π Multi-GPU Support**: Leverage multiple GPUs concurrently
- **π‘οΈ Automatic Management**: Resources released after function completion
### ZeroGPU Specifications
| Specification | Value |
|---------------|-------|
| **GPU Type** | NVIDIA H200 slice |
| **Available VRAM** | 70GB per workload |
| **Supported Gradio** | 4+ |
| **Supported PyTorch** | 2.1.2, 2.2.2, 2.4.0, 2.5.1 |
| **Supported Python** | 3.10.13 |
| **Function Duration** | Up to 120 seconds per request |
### Deploying to Hugging Face Spaces
1. **Create a new Space** on Hugging Face:
- Choose **Gradio SDK**
- Select **ZeroGPU** in hardware options
- Upload your code
2. **Space Configuration**:
```yaml
# app.py is automatically detected
# requirements.txt is automatically installed
# ZeroGPU is automatically configured
```
3. **Access Requirements**:
- **Personal accounts**: PRO subscription required
- **Organizations**: Enterprise Hub subscription required
- **Usage limits**: 10 Spaces (personal) / 50 Spaces (organization)
### ZeroGPU Integration Details
The demo automatically detects ZeroGPU availability and optimizes accordingly:
```python
# Automatic ZeroGPU detection
try:
import spaces
ZEROGPU_AVAILABLE = True
except ImportError:
ZEROGPU_AVAILABLE = False
# GPU-optimized functions
@spaces.GPU(duration=120) # 2 minutes for action generation
def generate_action(self, image, goal, instruction):
# GPU-accelerated inference
pass
@spaces.GPU(duration=90) # 1.5 minutes for chat responses
def chat_with_model(self, message, history, image):
# Interactive chat with GPU acceleration
pass
```
## π― How to Use
### Basic Usage
1. **Load Model**: Click "π Load L-Operator Model" to initialize the model
2. **Upload Screenshot**: Upload an Android device screenshot
3. **Provide Instructions**:
- **Goal**: Describe what you want to achieve
- **Step**: Provide specific step instructions
4. **Generate Action**: Click "π― Generate Action" to get JSON output
### Chat Interface
1. **Upload Screenshot**: Upload an Android screenshot
2. **Send Message**: Use structured format:
```
Goal: Open the Settings app and navigate to Display settings
Step: Tap on the Settings app icon on the home screen
```
3. **Get Response**: The model will generate JSON actions
### Example Episodes
The demo includes pre-loaded examples from the training episodes:
- **Episode 13**: Cruise deals app navigation
- **Episode 53**: Pinterest search for sustainability art
- **Episode 73**: Moon phases app usage
## π Expected Output Format
The model generates JSON actions in the following format:
```json
{
"action_type": "tap",
"x": 540,
"y": 1200,
"text": "Settings",
"app_name": "com.android.settings",
"confidence": 0.92
}
```
### Action Types
- `tap`: Tap at specific coordinates
- `click`: Click at specific coordinates
- `scroll`: Scroll in a direction (up/down/left/right)
- `input_text`: Input text
- `open_app`: Open a specific app
- `wait`: Wait for a moment
## π οΈ Technical Details
### Model Configuration
- **Device**: Automatically detects CUDA/CPU
- **Precision**: bfloat16 for CUDA, float32 for CPU
- **Generation**: Temperature 0.7, Top-p 0.9
- **Max Tokens**: 128 for action generation
### Architecture
- **Base Model**: LFM2-VL-1.6B from LiquidAI
- **Fine-tuning**: LoRA with rank 16, alpha 32
- **Target Modules**: q_proj, v_proj, fc1, fc2, linear, gate_proj, up_proj, down_proj
### Performance
- **Model Size**: ~1.6B parameters
- **Memory Usage**: ~4GB VRAM (CUDA) / ~8GB RAM (CPU)
- **Inference Speed**: Optimized for real-time use
- **Accuracy**: 98% action accuracy on test episodes
## π― Use Cases
### 1. Mobile App Testing
- Automated UI testing for Android applications
- Cross-device compatibility validation
- Regression testing with visual verification
### 2. Accessibility Applications
- Voice-controlled device navigation
- Assistive technology integration
- Screen reader enhancement tools
### 3. Remote Support
- Remote device troubleshooting
- Automated device configuration
- Support ticket automation
### 4. Development Workflows
- UI/UX testing automation
- User flow validation
- Performance testing integration
## β οΈ Important Notes
### Access Requirements
- **Investment Access**: This model is proprietary technology available exclusively to qualified investors under NDA
- **Authentication Required**: Must be authenticated with Hugging Face
- **Evaluation Only**: Access granted solely for investment evaluation purposes
- **Confidentiality**: All technical details are confidential
### ZeroGPU Limitations
- **Compatibility**: Currently exclusive to Gradio SDK
- **PyTorch Versions**: Limited to supported versions (2.1.2, 2.2.2, 2.4.0, 2.5.1)
- **Function Duration**: Maximum 60 seconds default, customizable up to 120 seconds
- **Queue Priority**: PRO users get x5 more daily usage and highest priority
### General Limitations
- **Market Hours**: Some features may be limited during market hours
- **Device Requirements**: Requires sufficient RAM/VRAM for model loading
- **Network**: Requires internet connection for model download
- **Authentication**: Must have approved access to the model
## π§ Troubleshooting
### Common Issues
1. **Model Loading Error**:
- Ensure you're authenticated: `huggingface-cli login`
- Check internet connection
- Verify model access approval
2. **Memory Issues**:
- Use CPU if GPU memory is insufficient
- Close other applications
- Consider using smaller batch sizes
3. **Authentication Errors**:
- Re-login to Hugging Face
- Check access approval status
- Contact support if issues persist
4. **ZeroGPU Issues**:
- Verify ZeroGPU is selected in Space settings
- Check PyTorch version compatibility
- Ensure function duration is within limits
### Performance Optimization
- **GPU Usage**: Use CUDA for faster inference
- **Memory Management**: Monitor VRAM usage
- **Batch Processing**: Process multiple images efficiently
- **ZeroGPU Optimization**: Specify appropriate function durations
## π Support
- **Investment Inquiries**: For investment-related questions and due diligence
- **Technical Support**: For technical issues with the demo
- **Model Access**: For access requests to the L-Operator model
- **ZeroGPU Support**: [ZeroGPU Documentation](https://huggingface.co/docs/hub/spaces-zerogpu)
## π License
This demo is provided under the same terms as the L-Operator model:
- **Proprietary Technology**: Owned by Tonic
- **Investment Evaluation**: Access granted solely for investment evaluation
- **NDA Required**: All access is subject to Non-Disclosure Agreement
- **No Commercial Use**: Without written consent
## π Acknowledgments
- **LiquidAI**: For the base LFM2-VL model
- **Hugging Face**: For the transformers library, hosting, and ZeroGPU infrastructure
- **Gradio**: For the excellent UI framework
## π Links
- [L-Operator Model](https://huggingface.co/Tonic/l-android-control)
- [Base Model (LFM2-VL-1.6B)](https://huggingface.co/LiquidAI/LFM2-VL-1.6B)
- [ZeroGPU Documentation](https://huggingface.co/docs/hub/spaces-zerogpu)
- [LiquidAI](https://liquid.ai/)
- [Tonic](https://tonic.ai/)
---
**Made with β€οΈ by Tonic**
|