import cv2 import gradio as gr def image_mod(image): gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) inverted_image = 255 - gray_image blurred = cv2.GaussianBlur(inverted_image, (21, 21), 0) inverted_blurred = 255 - blurred pencil_sketch = cv2.divide(gray_image, inverted_blurred, scale=256.0) return pencil_sketch # Define the Gradio interface gr.Interface(fn=image_mod, inputs="image", outputs="image").launch(share=True)