Image_To_Sketch / app.py
Muhammad-Izhan's picture
Upload app.py
c5490cf verified
raw
history blame contribute delete
395 Bytes
import gradio as gr
import cv2
import numpy as np
def sketch_image(image):
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
inverted = 255 - gray
blurred = cv2.GaussianBlur(inverted, (21, 21), 0)
sketch = cv2.divide(gray, 255 - blurred, scale=256)
return sketch
iface = gr.Interface(fn=sketch_image, inputs="image", outputs="image")
iface.launch(share=True)