Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,30 +1,26 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from detect import
|
| 3 |
-
from
|
| 4 |
-
from plot_map import generate_layout
|
| 5 |
-
from ultralytics import YOLO
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
outputs=gr.Image(label="2D ๊ณต์ฅ ๋ฏธ๋๋งต"),
|
| 25 |
-
title="๊ณต์ฅ ๊ตฌ์กฐ ์ธ์ ์๋ฎฌ๋ ์ดํฐ",
|
| 26 |
-
description="์์
ํ์ฅ ์์์ ๋ถ์ํ์ฌ ๊ตฌ์กฐ๋ฌผ์ ์์น๋ฅผ ์ถ๋ก ํ๊ณ 2D ํ๋ฉด๋๋ฅผ ์์ฑํฉ๋๋ค."
|
| 27 |
)
|
| 28 |
|
| 29 |
-
|
| 30 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from detect import detect_objects_in_video
|
| 3 |
+
from map_builder import generate_factory_map
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
def process_videos(video_paths):
|
| 6 |
+
print("[INFO] ์
๋ ฅ๋ ๋น๋์ค ์:", len(video_paths))
|
| 7 |
|
| 8 |
+
all_detections = []
|
| 9 |
+
for path in video_paths:
|
| 10 |
+
print(f"[INFO] ๋น๋์ค ์ฒ๋ฆฌ ์ค: {path}")
|
| 11 |
+
detections = detect_objects_in_video(path)
|
| 12 |
+
all_detections.extend(detections) # ๋ชจ๋ ๋น๋์ค์ ๊ตฌ์กฐ๋ฌผ ๊ฐ์ง ๊ฒฐ๊ณผ๋ฅผ ๋์
|
| 13 |
|
| 14 |
+
# ๊ณต์ฅ ๊ตฌ์กฐ ๋ฏธ๋๋งต ์์ฑ
|
| 15 |
+
minimap_image = generate_factory_map(all_detections)
|
| 16 |
+
return minimap_image
|
| 17 |
|
| 18 |
+
demo = gr.Interface(
|
| 19 |
+
fn=process_videos,
|
| 20 |
+
inputs=gr.File(file_types=["video"], label="์์
์ฅ ์์ ์
๋ก๋", multiple=True),
|
| 21 |
+
outputs=gr.Image(type="pil", label="๊ณต์ฅ ๊ตฌ์กฐ ๋ฏธ๋๋งต ์๋ฎฌ๋ ์ด์
"),
|
| 22 |
+
title="Factory Layout Simulator",
|
| 23 |
+
description="๋ณต์์ ๊ณต์ฅ ์์
์์์์ ๊ตฌ์กฐ๋ฌผ์ ๊ฐ์งํ๊ณ 2D ๋ฏธ๋๋งต ํํ๋ก ์๊ฐํํฉ๋๋ค."
|
|
|
|
|
|
|
|
|
|
| 24 |
)
|
| 25 |
|
| 26 |
+
demo.launch()
|
|
|