Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,7 +57,14 @@ def process_images(front_img, side_img, real_height_cm):
|
|
57 |
)
|
58 |
|
59 |
body_sizes = measure_body_sizes(side_colored_mask, front_colored_mask, sideposes, frontposes, real_height_cm, rainbow)
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
return measurements_df
|
62 |
|
63 |
# Create the Gradio interface
|
@@ -68,9 +75,6 @@ interface = gr.Interface(
|
|
68 |
gr.Image(sources="webcam", type="numpy", label="Side Pose"),
|
69 |
gr.Number(label="Enter Your Height (cm)")
|
70 |
],
|
71 |
-
outputs=[
|
72 |
-
gr.DataFrame(label="Body Size Measurements")
|
73 |
-
],
|
74 |
title="Body Sizing System Demo",
|
75 |
description="Capture two webcam images: Front View and Side View, and input your height in cm."
|
76 |
)
|
|
|
57 |
)
|
58 |
|
59 |
body_sizes = measure_body_sizes(side_colored_mask, front_colored_mask, sideposes, frontposes, real_height_cm, rainbow)
|
60 |
+
csv_file = "Body-measurement.csv"
|
61 |
+
if not os.path.exists(csv_file):
|
62 |
+
# Save as a new file if it doesn't exist
|
63 |
+
measurements_df.to_csv(csv_file, index=False)
|
64 |
+
else:
|
65 |
+
# Append to the existing file
|
66 |
+
measurements_df.to_csv(csv_file, mode='a', header=False, index=False)
|
67 |
+
|
68 |
return measurements_df
|
69 |
|
70 |
# Create the Gradio interface
|
|
|
75 |
gr.Image(sources="webcam", type="numpy", label="Side Pose"),
|
76 |
gr.Number(label="Enter Your Height (cm)")
|
77 |
],
|
|
|
|
|
|
|
78 |
title="Body Sizing System Demo",
|
79 |
description="Capture two webcam images: Front View and Side View, and input your height in cm."
|
80 |
)
|