File size: 3,711 Bytes
159cf40
 
 
 
 
 
 
 
 
 
 
37380c1
 
 
 
 
 
e749f25
37380c1
 
e749f25
37380c1
e749f25
 
 
 
 
37380c1
 
 
e749f25
37380c1
e749f25
 
37380c1
 
 
 
e749f25
 
 
37380c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e749f25
37380c1
e749f25
37380c1
 
e749f25
 
 
 
 
 
 
5b49b49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37380c1
e749f25
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
---
title: Multimodal A/B Test Predictor
emoji: πŸš€
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: "4.44.0"
app_file: app.py
pinned: false
---

# πŸš€ Multimodal A/B Test Predictor

## Overview
Advanced A/B testing outcome predictor using multimodal AI analysis combining:
- πŸ–ΌοΈ **Image Analysis**: Visual features from control & variant images
- πŸ“ **OCR Text Extraction**: Automatically extracts and analyzes text from images  
- πŸ“Š **Categorical Features**: Business context provided via API (industry, page type, etc.)
- 🎯 **Confidence Scores**: Based on training data statistics and historical accuracy

## 🎯 Direct Input Architecture

### **Image + Categorical Data**
- Accepts control and variant images directly via API
- Requires categorical inputs: Business Model, Customer Type, Conversion Type, Industry, Page Type
- Fast, efficient predictions without external API dependencies
- All processing happens locally on GPU

## 🎯 Features

### Direct Prediction with Categorical Data
- Upload control & variant images
- Provide categorical business context data
- Fast prediction with comprehensive confidence analysis

### Enhanced Results
- **Winner Prediction**: Variant vs Control with probability
- **Model Confidence**: Accuracy percentage from training data
- **Training Data Count**: Number of samples model trained on for this category
- **Historical Win/Loss**: Real A/B test outcome statistics for this category
- **Confidence Source**: Industry + Page Type combination used for scoring

## πŸ”§ Setup

### Model Files
- `model/multimodal_gated_model_2.7_GGG.pth`: Enhanced multimodal model (789MB)
- `model/multimodal_cat_mappings_GGG.json`: Category mappings

## πŸš€ Technical Architecture

### Model: SupervisedSiameseMultimodal (GGG Enhanced)
- **Vision**: ViT (Vision Transformer) for image features
- **Text**: DistilBERT for OCR text processing
- **Fusion**: Gated fusion with directional features
- **Categories**: Embedding layers for categorical features
- **Architecture**: BatchNorm + Fusion Block + Enhanced Prediction Head

### Confidence Scoring
- Based on Industry + Page Type combinations
- Uses holdout statistics with average 160 samples per combination
- Much more reliable than full 5-feature combinations

## πŸ“Š Performance
- **Multimodal Analysis**: Images + Text + Categories
- **GPU Accelerated**: Fast predictions (2-4 seconds average)
- **High Accuracy**: Enhanced GGG architecture with real training data
- **No External Dependencies**: All processing done locally

## 🎯 Use Cases
- **A/B Test Prediction**: Predict winners before running tests with provided context
- **Batch Processing**: Process multiple tests efficiently from CSV
- **Confidence Assessment**: Understand prediction reliability based on historical data
- **API Integration**: Easy integration with external systems

## πŸ“‘ API Usage

### Quick Start
```python
from gradio_client import Client

client = Client("SpiralyzeLLC/ABTestPredictor")
result = client.predict(
    "control.jpg", "variant.jpg",
    "SaaS", "B2B", "High-Intent Lead Gen",
    "B2B Software & Tech", "Awareness & Discovery",
    api_name="/predict_with_categorical_data"
)
```

### πŸ“š Documentation

- **[QUICK_START_GUIDE.md](QUICK_START_GUIDE.md)** - Get started in 3 steps
- **[API_DOCUMENTATION.md](API_DOCUMENTATION.md)** - Complete API reference with examples in Python, JavaScript, and cURL
- **[API_USAGE_UPDATED.md](API_USAGE_UPDATED.md)** - Technical details and migration notes

### 🌐 Web Interface

Use the interactive interface: **https://huggingface.co/spaces/SpiralyzeLLC/ABTestPredictor**

---

Built with ❀️ using Gradio, PyTorch, Transformers, and Hugging Face.