Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from PIL import Image, ImageFilter
|
| 3 |
+
|
| 4 |
+
def process_image(img):
|
| 5 |
+
if img is None:
|
| 6 |
+
return None
|
| 7 |
+
img = img.convert("RGB")
|
| 8 |
+
output = img.filter(ImageFilter.EDGE_ENHANCE_MORE)
|
| 9 |
+
return output
|
| 10 |
+
|
| 11 |
+
with gr.Blocks(title="Edge Enhance Image Filter") as demo:
|
| 12 |
+
gr.Markdown("## Edge Enhance Image Filter")
|
| 13 |
+
gr.Markdown("Upload an image and apply EDGE_ENHANCE_MORE filter.")
|
| 14 |
+
|
| 15 |
+
with gr.Row():
|
| 16 |
+
input_image = gr.Image(type="pil", label="Upload Image")
|
| 17 |
+
output_image = gr.Image(type="pil", label="Processed Image")
|
| 18 |
+
|
| 19 |
+
process_btn = gr.Button("Process")
|
| 20 |
+
|
| 21 |
+
process_btn.click(
|
| 22 |
+
fn=process_image,
|
| 23 |
+
inputs=input_image,
|
| 24 |
+
outputs=output_image
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
demo.launch()
|