shin0624 commited on
Commit
f10a28a
ยท
verified ยท
1 Parent(s): ca406ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -11,14 +11,18 @@ def process_video(video):
11
  with tempfile.TemporaryDirectory() as tmpdir:
12
  # 1. ํ‚คํ”„๋ ˆ์ž„ ์ถ”์ถœ
13
  frames_dir = os.path.join(tmpdir, "frames")
 
14
  frame_paths = extract_keyframes(video, frames_dir)
15
 
 
 
 
16
  # 2. 3D ํฌ์ธํŠธ ํด๋ผ์šฐ๋“œ ์ƒ์„ฑ
17
  reconstructor = YOLO3DReconstructor()
18
  result = reconstructor.process_frames(frame_paths)
19
 
20
  if result is None:
21
- raise gr.Error("No detectable objects found in the video!")
22
 
23
  pointcloud, detections = result
24
 
@@ -71,6 +75,7 @@ iface = gr.Interface(
71
  title="๐Ÿญ AI ๊ณต์žฅ ๊ตฌ์กฐ ๋ถ„์„ ์‹œ์Šคํ…œ",
72
  description="์—…๋กœ๋“œ๋œ ๊ณต์žฅ ์˜์ƒ์—์„œ 3D ๊ตฌ์กฐ๋งต๊ณผ ๋ถ„์„ ๋ฆฌํฌํŠธ๋ฅผ ์ž๋™ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค",
73
  allow_flagging="never",
 
74
  )
75
 
76
  if __name__ == "__main__":
 
11
  with tempfile.TemporaryDirectory() as tmpdir:
12
  # 1. ํ‚คํ”„๋ ˆ์ž„ ์ถ”์ถœ
13
  frames_dir = os.path.join(tmpdir, "frames")
14
+ os.makedirs(frames_dir, exist_ok=True)
15
  frame_paths = extract_keyframes(video, frames_dir)
16
 
17
+ if not frame_paths:
18
+ raise gr.Error("๋น„๋””์˜ค ํŒŒ์ผ์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค!")
19
+
20
  # 2. 3D ํฌ์ธํŠธ ํด๋ผ์šฐ๋“œ ์ƒ์„ฑ
21
  reconstructor = YOLO3DReconstructor()
22
  result = reconstructor.process_frames(frame_paths)
23
 
24
  if result is None:
25
+ raise gr.Error("์˜์ƒ์—์„œ ๊ฐ์ง€ ๊ฐ€๋Šฅํ•œ ๊ฐ์ฒด๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค!")
26
 
27
  pointcloud, detections = result
28
 
 
75
  title="๐Ÿญ AI ๊ณต์žฅ ๊ตฌ์กฐ ๋ถ„์„ ์‹œ์Šคํ…œ",
76
  description="์—…๋กœ๋“œ๋œ ๊ณต์žฅ ์˜์ƒ์—์„œ 3D ๊ตฌ์กฐ๋งต๊ณผ ๋ถ„์„ ๋ฆฌํฌํŠธ๋ฅผ ์ž๋™ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค",
77
  allow_flagging="never",
78
+ examples=[], # ์˜ˆ์‹œ ์ถ”๊ฐ€ ๊ฐ€๋Šฅ
79
  )
80
 
81
  if __name__ == "__main__":