Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,7 +108,7 @@ def process_image():
|
|
| 108 |
image_np = np.array(image)
|
| 109 |
|
| 110 |
# Hiển thị ảnh gốc
|
| 111 |
-
st.image(image_np, caption="Ảnh đã tải lên",
|
| 112 |
else:
|
| 113 |
# Sử dụng ảnh mẫu
|
| 114 |
sample_img_url = "https://storage.googleapis.com/sfr-vision-language-research/DINO/ground_truth_images/000000014439.jpg"
|
|
@@ -118,7 +118,7 @@ def process_image():
|
|
| 118 |
image_np = np.array(image)
|
| 119 |
|
| 120 |
# Hiển thị ảnh mẫu
|
| 121 |
-
st.image(image_np, caption="Ảnh mẫu",
|
| 122 |
except Exception as e:
|
| 123 |
st.error(f"Không thể tải ảnh mẫu: {e}")
|
| 124 |
|
|
@@ -210,8 +210,8 @@ def process_image():
|
|
| 210 |
st.success(f"Đã phát hiện {person_count} người trong ảnh")
|
| 211 |
|
| 212 |
col1, col2 = st.columns(2)
|
| 213 |
-
col1.image(output_image, caption="Phát hiện người với độ sâu",
|
| 214 |
-
col2.image(depth_colormap, caption="Bản đồ độ sâu",
|
| 215 |
|
| 216 |
# Chức năng xử lý video
|
| 217 |
def process_video():
|
|
@@ -381,8 +381,8 @@ def process_video():
|
|
| 381 |
|
| 382 |
# Hiển thị khung hình trong Streamlit (cập nhật theo khoảng)
|
| 383 |
if frame_counter % 5 == 0 or frame_counter == 1:
|
| 384 |
-
detection_placeholder.image(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB), caption="Phát hiện người",
|
| 385 |
-
depth_placeholder.image(depth_colormap, caption="Bản đồ độ sâu",
|
| 386 |
|
| 387 |
# Ghi khung hình vào videos
|
| 388 |
out_detection.write(frame)
|
|
|
|
| 108 |
image_np = np.array(image)
|
| 109 |
|
| 110 |
# Hiển thị ảnh gốc
|
| 111 |
+
st.image(image_np, caption="Ảnh đã tải lên", use_container_width=True)
|
| 112 |
else:
|
| 113 |
# Sử dụng ảnh mẫu
|
| 114 |
sample_img_url = "https://storage.googleapis.com/sfr-vision-language-research/DINO/ground_truth_images/000000014439.jpg"
|
|
|
|
| 118 |
image_np = np.array(image)
|
| 119 |
|
| 120 |
# Hiển thị ảnh mẫu
|
| 121 |
+
st.image(image_np, caption="Ảnh mẫu", use_container_width=True)
|
| 122 |
except Exception as e:
|
| 123 |
st.error(f"Không thể tải ảnh mẫu: {e}")
|
| 124 |
|
|
|
|
| 210 |
st.success(f"Đã phát hiện {person_count} người trong ảnh")
|
| 211 |
|
| 212 |
col1, col2 = st.columns(2)
|
| 213 |
+
col1.image(output_image, caption="Phát hiện người với độ sâu", use_container_width=True)
|
| 214 |
+
col2.image(depth_colormap, caption="Bản đồ độ sâu", use_container_width=True)
|
| 215 |
|
| 216 |
# Chức năng xử lý video
|
| 217 |
def process_video():
|
|
|
|
| 381 |
|
| 382 |
# Hiển thị khung hình trong Streamlit (cập nhật theo khoảng)
|
| 383 |
if frame_counter % 5 == 0 or frame_counter == 1:
|
| 384 |
+
detection_placeholder.image(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB), caption="Phát hiện người", use_container_width=True)
|
| 385 |
+
depth_placeholder.image(depth_colormap, caption="Bản đồ độ sâu", use_container_width=True)
|
| 386 |
|
| 387 |
# Ghi khung hình vào videos
|
| 388 |
out_detection.write(frame)
|