Spaces:
Running
Running
Create app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
def
|
4 |
-
#
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
fn=
|
9 |
-
inputs=gr.Image(type="
|
10 |
-
outputs="
|
11 |
title="Floorplan AI",
|
12 |
description="Makan ki image upload karo aur naksha banao."
|
13 |
)
|
14 |
|
15 |
-
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import cv2
|
3 |
+
import numpy as np
|
4 |
|
5 |
+
def make_floorplan(image):
|
6 |
+
# Convert image to grayscale
|
7 |
+
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
8 |
+
# Edge detection
|
9 |
+
edges = cv2.Canny(gray, 100, 200)
|
10 |
+
# Convert edges back to 3 channels
|
11 |
+
edges_rgb = cv2.cvtColor(edges, cv2.COLOR_GRAY2BGR)
|
12 |
+
return edges_rgb
|
13 |
|
14 |
+
demo = gr.Interface(
|
15 |
+
fn=make_floorplan,
|
16 |
+
inputs=gr.Image(type="numpy", label="Makan ki tasveer upload karo"),
|
17 |
+
outputs=gr.Image(type="numpy", label="Output Floorplan"),
|
18 |
title="Floorplan AI",
|
19 |
description="Makan ki image upload karo aur naksha banao."
|
20 |
)
|
21 |
|
22 |
+
if __name__ == "__main__":
|
23 |
+
demo.launch()
|