cr8 commited on
Commit
6b248ff
·
verified ·
1 Parent(s): 3ec82b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from PIL import Image, ImageEnhance
3
 
4
  def enhance_vibrancy(image, vibrancy_factor):
5
  # Convert to RGB (JPEG doesn't support transparency)
@@ -13,6 +13,20 @@ def enhance_vibrancy(image, vibrancy_factor):
13
  image = ImageEnhance.Brightness(image).enhance(1.0 + (vibrancy_factor-1)*0.2)
14
  image = ImageEnhance.Contrast(image).enhance(1.0 + (vibrancy_factor-1)*0.1)
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  return image
17
 
18
  iface = gr.Interface(
@@ -27,7 +41,7 @@ iface = gr.Interface(
27
  format="jpeg" # Force JPEG output
28
  ),
29
  title=" Vibrancy Booster",
30
- description=" enhancing colors (1.0 = original vibrancy)"
31
  )
32
 
33
  if __name__ == "__main__":
 
1
  import gradio as gr
2
+ from PIL import Image, ImageEnhance, ImageFilter
3
 
4
  def enhance_vibrancy(image, vibrancy_factor):
5
  # Convert to RGB (JPEG doesn't support transparency)
 
13
  image = ImageEnhance.Brightness(image).enhance(1.0 + (vibrancy_factor-1)*0.2)
14
  image = ImageEnhance.Contrast(image).enhance(1.0 + (vibrancy_factor-1)*0.1)
15
 
16
+ # Add sharpness (1.5 base value, scaled slightly with vibrancy)
17
+ sharpness_factor = 1.5 + (vibrancy_factor-1)*0.3
18
+ image = ImageEnhance.Sharpness(image).enhance(sharpness_factor)
19
+
20
+ # Add depth effect with subtle background blur
21
+ # Create a slightly blurred version
22
+ blurred = image.filter(ImageFilter.GaussianBlur(radius=2))
23
+
24
+ # Enhance contrast on original to make subject pop
25
+ foreground = ImageEnhance.Contrast(image).enhance(1.2)
26
+
27
+ # Blend original (sharp) with blurred background (70% foreground, 30% blur)
28
+ image = Image.blend(blurred, foreground, 0.7)
29
+
30
  return image
31
 
32
  iface = gr.Interface(
 
41
  format="jpeg" # Force JPEG output
42
  ),
43
  title=" Vibrancy Booster",
44
+ description="enhancing colors, sharpness, and depth (1.0 = original vibrancy)"
45
  )
46
 
47
  if __name__ == "__main__":