Spaces:
Running
Running
File size: 563 Bytes
6339c79 28ba081 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import cv2
import gradio as gr
import numpy as np
def edge_detection(image):
# Convert image to grayscale
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Apply edge detection
edges = cv2.Canny(gray_image, 100, 200)
return edges
# Gradio interface
iface = gr.Interface(
fn=edge_detection,
inputs=gr.Image(type="numpy"),
outputs="image",
title="Edge Detection with OpenCV",
description="Upload an image and get the edges detected using OpenCV's Canny edge detector."
)
iface.launch(share=True)
|