Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,9 +17,9 @@ def decode(im,col):
|
|
| 17 |
newData = []
|
| 18 |
h1 = col.strip("#")
|
| 19 |
rgb_tup = tuple(int(h1[i:i+2], 16) for i in (0, 2, 4))
|
| 20 |
-
|
| 21 |
for item in datas:
|
| 22 |
-
if item[0] in range(rgb_tup[0]-
|
| 23 |
newData.append((0,0,0))
|
| 24 |
else:
|
| 25 |
newData.append((255,255,255))
|
|
|
|
| 17 |
newData = []
|
| 18 |
h1 = col.strip("#")
|
| 19 |
rgb_tup = tuple(int(h1[i:i+2], 16) for i in (0, 2, 4))
|
| 20 |
+
tol=100
|
| 21 |
for item in datas:
|
| 22 |
+
if item[0] in range(rgb_tup[0]-tol,rgb_tup[0]+tol) and item[1] in range(rgb_tup[1]-tol,rgb_tup[1]+tol) and item[2] in range(rgb_tup[2]-tol,rgb_tup[2]+tol):
|
| 23 |
newData.append((0,0,0))
|
| 24 |
else:
|
| 25 |
newData.append((255,255,255))
|