Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def image_mod(image):
|
5 |
+
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
6 |
+
inverted_image = 255 - gray_image
|
7 |
+
blurred = cv2.GaussianBlur(inverted_image, (21, 21), 0)
|
8 |
+
inverted_blurred = 255 - blurred
|
9 |
+
pencil_sketch = cv2.divide(gray_image, inverted_blurred, scale=256.0)
|
10 |
+
return pencil_sketch
|
11 |
+
|
12 |
+
# Define the Gradio interface
|
13 |
+
gr.Interface(fn=image_mod, inputs="image", outputs="image").launch(share=True)
|