File size: 4,276 Bytes
a891b12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# πŸ”§ Hugging Face Spaces Configuration

## YAML Front Matter Configuration

File `README.md` harus dimulai dengan YAML front matter configuration:

```yaml

---

title: FunCaptcha Solver API

emoji: 🧩

colorFrom: blue

colorTo: purple

sdk: docker

pinned: false

suggested_hardware: cpu-basic

app_file: app.py

---

```

## πŸ“‹ Configuration Options

### **Required Fields**

| Field | Value | Description |
|---|---|---|
| `sdk` | `docker` | **CRITICAL**: Must be "docker" for Docker-based spaces |
| `title` | `FunCaptcha Solver API` | Display name di HF Spaces |

### **Optional Fields**

| Field | Default Value | Description | Options |
|---|---|---|---|
| `emoji` | `🧩` | Icon untuk space | Any emoji |
| `colorFrom` | `blue` | Gradient start color | blue, red, green, yellow, etc. |
| `colorTo` | `purple` | Gradient end color | purple, pink, orange, etc. |
| `pinned` | `false` | Pin space di profile | `true` / `false` |
| `app_file` | `app.py` | Main application file | Any Python file |
| `suggested_hardware` | `cpu-basic` | Hardware suggestion | See below |

### **Hardware Options**

| Hardware | Description | Use Case |
|---|---|---|
| `cpu-basic` | **2 vCPU, 16GB RAM** | βœ… **Recommended untuk FunCaptcha** |
| `cpu-upgrade` | 8 vCPU, 32GB RAM | Heavy ML workloads |
| `t4-small` | GPU T4, 15GB VRAM | GPU-accelerated inference |
| `t4-medium` | GPU T4, 60GB RAM | Large GPU models |

> πŸ’‘ **Tip**: `cpu-basic` sudah cukup untuk FunCaptcha solver dengan optimasi yang sudah diterapkan.

## 🚨 Common Configuration Errors

### **Error: "Missing configuration in README"**

**Cause**: README.md tidak dimulai dengan YAML front matter

**Solution**: 
```yaml

# ❌ WRONG - Missing YAML front matter

# FunCaptcha Solver API



# βœ… CORRECT - With YAML front matter  

---

title: FunCaptcha Solver API

emoji: 🧩

sdk: docker

---



# FunCaptcha Solver API

```

### **Error: "Invalid SDK configuration"**

**Cause**: `sdk` field salah atau missing

**Solution**:
```yaml

# ❌ WRONG

sdk: python

# or missing sdk field



# βœ… CORRECT

sdk: docker

```

### **Error: "Space fails to start"**

**Possible causes & solutions**:

1. **Dockerfile issues**
   - Check Dockerfile syntax
   - Verify all dependencies installed
   - Check port 7860 exposed

2. **Missing model files**
   - Upload `best.onnx` dan `data.yaml`
   - Check file paths in app.py

3. **Missing API key**
   - Set `FUNCAPTCHA_API_KEY` di space secrets
   - Verify secret name exactly matches

## πŸ› οΈ Customization Options

### **Custom Title & Branding**

```yaml

---

title: Your Custom FunCaptcha API

emoji: πŸ€–

colorFrom: green

colorTo: blue

---

```

### **Private Space**

Set space visibility to **Private** during creation (tidak bisa diubah via YAML).

### **Custom App File**

Jika rename `app.py`:

```yaml

---

sdk: docker

app_file: main.py  # Your custom filename

---

```

### **Hardware Upgrade**

Untuk performa lebih tinggi:

```yaml

---

sdk: docker

suggested_hardware: cpu-upgrade  # More powerful CPU

---

```

## πŸ” Validation Checklist

Sebelum deploy, pastikan:

- [ ] README.md dimulai dengan `---`
- [ ] `sdk: docker` field present
- [ ] `title` field specified
- [ ] YAML format valid (no tabs, proper indentation)
- [ ] File ends dengan `---` dan newline
- [ ] No syntax errors dalam YAML

## πŸ§ͺ Testing Configuration

```bash

# Test YAML syntax locally

python -c "import yaml; yaml.safe_load(open('README.md').read().split('---')[1])"



# Check for required fields

grep -E "^(sdk|title):" README.md

```

## πŸ“ Template untuk Custom Spaces

```yaml

---

title: "Your App Name"

emoji: πŸš€

colorFrom: blue

colorTo: purple  

sdk: docker

pinned: false

suggested_hardware: cpu-basic

app_file: app.py

license: mit

short_description: "Brief description of your space"

---



# Your App Name



Your app description here...

```

---

**⚠️ CRITICAL**: Tanpa proper YAML front matter, HF Spaces tidak akan recognize space sebagai Docker-based application dan akan fail untuk start!

**βœ… Quick Fix**: Copy exact YAML header dari `README.md` yang sudah disediakan dalam deployment package.