sainkan commited on
Commit
7b61a40
1 Parent(s): 7afd355

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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 processed_image, temp_filepath
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}")