Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +32 -32
src/streamlit_app.py
CHANGED
|
@@ -151,38 +151,38 @@ if uploaded is not None:
|
|
| 151 |
|
| 152 |
pts = to_xy(pred)
|
| 153 |
|
| 154 |
-
st.subheader('Prediction (keypoints on original image)')
|
| 155 |
-
|
| 156 |
-
w, h = pil_img.size # original size
|
| 157 |
-
scale_x = w / 96.0
|
| 158 |
-
scale_y = h / 96.0
|
| 159 |
-
|
| 160 |
-
pts_scaled = [(x * scale_x, y * scale_y) for (x, y) in pts]
|
| 161 |
-
|
| 162 |
-
overlay = draw_keypoints(pil_img, pts_scaled)
|
| 163 |
-
st.image(overlay, use_container_width=True)
|
| 164 |
-
|
| 165 |
-
st.subheader('Prediction (keypoints on 96×96)')
|
| 166 |
-
img96 = pil_img.resize((96, 96)).convert('RGB')
|
| 167 |
-
overlay96 = draw_keypoints(img96, pts)
|
| 168 |
-
st.image(overlay96, use_container_width=False)
|
| 169 |
-
|
| 170 |
-
st.subheader('Keypoints table (x, y)')
|
| 171 |
-
# Build a nice table using target_cols order
|
| 172 |
-
# target_cols is typically like: ['left_eye_center_x', 'left_eye_center_y', ...]
|
| 173 |
-
rows = []
|
| 174 |
-
for i in range(0, len(target_cols), 2):
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
st.dataframe(rows, use_container_width=True)
|
| 186 |
|
| 187 |
else:
|
| 188 |
st.info('Upload an image to get predictions.')
|
|
|
|
| 151 |
|
| 152 |
pts = to_xy(pred)
|
| 153 |
|
| 154 |
+
st.subheader('Prediction (keypoints on original image)')
|
| 155 |
+
|
| 156 |
+
w, h = pil_img.size # original size
|
| 157 |
+
scale_x = w / 96.0
|
| 158 |
+
scale_y = h / 96.0
|
| 159 |
+
|
| 160 |
+
pts_scaled = [(x * scale_x, y * scale_y) for (x, y) in pts]
|
| 161 |
+
|
| 162 |
+
overlay = draw_keypoints(pil_img, pts_scaled)
|
| 163 |
+
st.image(overlay, use_container_width=True)
|
| 164 |
+
|
| 165 |
+
st.subheader('Prediction (keypoints on 96×96)')
|
| 166 |
+
img96 = pil_img.resize((96, 96)).convert('RGB')
|
| 167 |
+
overlay96 = draw_keypoints(img96, pts)
|
| 168 |
+
st.image(overlay96, use_container_width=False)
|
| 169 |
+
|
| 170 |
+
st.subheader('Keypoints table (x, y)')
|
| 171 |
+
# Build a nice table using target_cols order
|
| 172 |
+
# target_cols is typically like: ['left_eye_center_x', 'left_eye_center_y', ...]
|
| 173 |
+
rows = []
|
| 174 |
+
for i in range(0, len(target_cols), 2):
|
| 175 |
+
name_x = target_cols[i]
|
| 176 |
+
name_y = target_cols[i + 1]
|
| 177 |
+
rows.append({
|
| 178 |
+
'keypoint': name_x.replace('_x', ''),
|
| 179 |
+
'x_name': name_x,
|
| 180 |
+
'y_name': name_y,
|
| 181 |
+
'x': float(pred[i]),
|
| 182 |
+
'y': float(pred[i + 1]),
|
| 183 |
+
})
|
| 184 |
+
|
| 185 |
+
st.dataframe(rows, use_container_width=True)
|
| 186 |
|
| 187 |
else:
|
| 188 |
st.info('Upload an image to get predictions.')
|