Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,9 +14,16 @@ from transparent_background import Remover
|
|
| 14 |
@spaces.GPU()
|
| 15 |
def doo(video, color, mode, progress=gr.Progress()):
|
| 16 |
print(color)
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
if mode == 'Fast':
|
| 21 |
remover = Remover(mode='fast')
|
| 22 |
else:
|
|
|
|
| 14 |
@spaces.GPU()
|
| 15 |
def doo(video, color, mode, progress=gr.Progress()):
|
| 16 |
print(color)
|
| 17 |
+
if color.startswith('#'):
|
| 18 |
+
color = color.lstrip('#')
|
| 19 |
+
rgb = tuple(int(color[i:i+2], 16) for i in (0, 2, 4))
|
| 20 |
+
color = str(list(rgb))
|
| 21 |
+
elif color.startswith('rgba'):
|
| 22 |
+
rgba_match = re.match(r'rgba\((\d+), (\d+), (\d+), ([\d.]+)\)', color)
|
| 23 |
+
if rgba_match:
|
| 24 |
+
r, g, b, _ = rgba_match.groups()
|
| 25 |
+
color = str([int(r), int(g), int(b)])
|
| 26 |
+
print(color)
|
| 27 |
if mode == 'Fast':
|
| 28 |
remover = Remover(mode='fast')
|
| 29 |
else:
|