File size: 2,417 Bytes
e4599d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# cURL Examples for Colorization API

## Base URL
```
https://logicgoinfotechspaces-text-guided-image-colorization.hf.space
```

## 1. Health Check (No Auth Required)
```bash
curl -X GET "https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/health" \
  -H "User-Agent: Mozilla/5.0"
```

## 2. Colorize Image (With Firebase Auth)

### Using Firebase ID Token
```bash
curl -X POST "https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/colorize" \
  -H "Authorization: Bearer YOUR_FIREBASE_ID_TOKEN" \
  -H "User-Agent: Mozilla/5.0" \
  -F "file=@/path/to/your/image.jpg"
```

### Using App Check Token
```bash
curl -X POST "https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/colorize" \
  -H "X-Firebase-AppCheck: YOUR_APP_CHECK_TOKEN" \
  -H "User-Agent: Mozilla/5.0" \
  -F "file=@/path/to/your/image.jpg"
```

### Without Auth (if DISABLE_AUTH=true)
```bash
curl -X POST "https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/colorize" \
  -H "User-Agent: Mozilla/5.0" \
  -F "file=@/path/to/your/image.jpg" \
  -o colorized_result.png
```

## 3. Windows PowerShell Example
```powershell
$imagePath = "C:\projects\colorize_text\pexels-andrey-grushnikov-223358-707676.jpg"
$headers = @{
    "User-Agent" = "Mozilla/5.0"
}
$form = @{
    file = Get-Item $imagePath
}
Invoke-RestMethod -Uri "https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/colorize" `
    -Method Post `
    -Headers $headers `
    -Form $form `
    -OutFile "colorized_result.png"
```

## 4. Python requests Example
```python
import requests

url = "https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/colorize"
headers = {
    "User-Agent": "Mozilla/5.0",
    # "Authorization": "Bearer YOUR_FIREBASE_ID_TOKEN",  # Uncomment if auth enabled
}
files = {
    "file": ("image.jpg", open("path/to/image.jpg", "rb"), "image/jpeg")
}

response = requests.post(url, headers=headers, files=files)
if response.status_code == 200:
    with open("colorized_result.png", "wb") as f:
        f.write(response.content)
    print("Colorized image saved!")
else:
    print(f"Error: {response.status_code} - {response.text}")
```

## Response
- **Success (200)**: Returns PNG image file
- **Error (400)**: Bad request (invalid file type)
- **Error (401)**: Unauthorized (missing/invalid auth token)
- **Error (503)**: Service unavailable (model not loaded)