Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def apply_blur(image, mode):
|
4 |
+
if mode == "Gaussian Blur":
|
5 |
+
return segment_and_blur(image)
|
6 |
+
else:
|
7 |
+
return depth_blur(image)
|
8 |
+
|
9 |
+
iface = gr.Interface(
|
10 |
+
fn=apply_blur,
|
11 |
+
inputs=[
|
12 |
+
gr.Image(type="numpy", label="Upload Image"),
|
13 |
+
gr.Radio(["Gaussian Blur", "Depth-Based Blur"], label="Choose Blur Type")
|
14 |
+
],
|
15 |
+
outputs=gr.Image(type="numpy", label="Blurred Output"),
|
16 |
+
title="Image Blur Demo",
|
17 |
+
description="Apply background Gaussian blur or depth-based lens blur using Transformers"
|
18 |
+
)
|
19 |
+
|
20 |
+
iface.launch()
|