Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,13 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def analyze_brushstroke(image):
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
demo = gr.Interface(fn=analyze_brushstroke, inputs="image", outputs="
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import cv2
|
| 4 |
|
| 5 |
def analyze_brushstroke(image):
|
| 6 |
+
# แปลงภาพเป็นขาวดำ และตรวจจับขอบภาพ (Edge Detection)
|
| 7 |
+
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
| 8 |
+
edges = cv2.Canny(gray, 100, 200)
|
| 9 |
+
|
| 10 |
+
return edges # คืนค่าภาพที่ประมวลผลแล้ว
|
| 11 |
|
| 12 |
+
demo = gr.Interface(fn=analyze_brushstroke, inputs="image", outputs="image")
|
| 13 |
demo.launch()
|