Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,9 +45,9 @@ def process(image, color):
|
|
| 45 |
# Convert hex color to RGB
|
| 46 |
color_rgb = tuple(int(color[i:i+2], 16) for i in (1, 3, 5))
|
| 47 |
background = Image.new("RGBA", image_size, color_rgb + (255,))
|
| 48 |
-
|
| 49 |
# Composite the image onto the background using the mask
|
| 50 |
-
image = Image.composite(image, background, mask)
|
| 51 |
|
| 52 |
return image
|
| 53 |
|
|
@@ -90,7 +90,7 @@ def fn(vid, color="#00FF00", fps=0):
|
|
| 90 |
processed_video.write_videofile(temp_filepath, codec="libx264")
|
| 91 |
|
| 92 |
yield gr.update(visible=False), gr.update(visible=True)
|
| 93 |
-
yield
|
| 94 |
|
| 95 |
except Exception as e:
|
| 96 |
print(f"Error: {e}")
|
|
|
|
| 45 |
# Convert hex color to RGB
|
| 46 |
color_rgb = tuple(int(color[i:i+2], 16) for i in (1, 3, 5))
|
| 47 |
background = Image.new("RGBA", image_size, color_rgb + (255,))
|
| 48 |
+
|
| 49 |
# Composite the image onto the background using the mask
|
| 50 |
+
image = Image.composite(image.convert("RGBA"), background, mask)
|
| 51 |
|
| 52 |
return image
|
| 53 |
|
|
|
|
| 90 |
processed_video.write_videofile(temp_filepath, codec="libx264")
|
| 91 |
|
| 92 |
yield gr.update(visible=False), gr.update(visible=True)
|
| 93 |
+
yield None, temp_filepath # Return the final video path here
|
| 94 |
|
| 95 |
except Exception as e:
|
| 96 |
print(f"Error: {e}")
|