Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,31 +1,27 @@
|
|
| 1 |
-
import torch
|
| 2 |
import gradio as gr
|
| 3 |
-
from PIL import Image
|
| 4 |
-
from transformers import AutoImageProcessor, AutoModelForImageProcessing
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
enhanced_image = processor.post_process_output(outputs.pixel_values)
|
| 20 |
-
return enhanced_image[0]
|
| 21 |
|
| 22 |
# Gradio Interface
|
| 23 |
iface = gr.Interface(
|
| 24 |
-
fn=
|
| 25 |
-
inputs=gr.Image(type="pil", label="
|
| 26 |
outputs=gr.Image(type="pil", label="Vibrant Image"),
|
| 27 |
-
title="
|
| 28 |
-
description="Enhance
|
| 29 |
)
|
| 30 |
|
| 31 |
if __name__ == "__main__":
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from PIL import Image, ImageEnhance
|
|
|
|
| 3 |
|
| 4 |
+
def enhance_vibrancy(image):
|
| 5 |
+
# Convert to RGB if needed
|
| 6 |
+
image = image.convert("RGB")
|
| 7 |
+
|
| 8 |
+
# Enhance color saturation
|
| 9 |
+
enhancer = ImageEnhance.Color(image)
|
| 10 |
+
vibrant_image = enhancer.enhance(2.0) # 2.0x saturation
|
| 11 |
|
| 12 |
+
# Enhance brightness slightly
|
| 13 |
+
enhancer = ImageEnhance.Brightness(vibrant_image)
|
| 14 |
+
vibrant_image = enhancer.enhance(1.2)
|
| 15 |
|
| 16 |
+
return vibrant_image
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Gradio Interface
|
| 19 |
iface = gr.Interface(
|
| 20 |
+
fn=enhance_vibrancy,
|
| 21 |
+
inputs=gr.Image(type="pil", label="Original Image"),
|
| 22 |
outputs=gr.Image(type="pil", label="Vibrant Image"),
|
| 23 |
+
title="Simple Image Vibrancy Booster",
|
| 24 |
+
description="Enhance image vibrancy using basic color adjustments (no AI involved)"
|
| 25 |
)
|
| 26 |
|
| 27 |
if __name__ == "__main__":
|