Spaces:
Sleeping
Sleeping
Niharmahesh
commited on
Commit
•
4ef1666
1
Parent(s):
9682d7c
Update app.py
Browse files
app.py
CHANGED
@@ -63,16 +63,16 @@ with tab1:
|
|
63 |
col1, col2 = st.columns(2)
|
64 |
with col1:
|
65 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
66 |
-
|
67 |
-
probabilities, landmarks = process_and_predict(image
|
68 |
-
|
69 |
if probabilities is not None and landmarks is not None:
|
70 |
with col2:
|
71 |
st.subheader("Top 5 Predictions:")
|
72 |
top_indices = np.argsort(probabilities)[::-1][:5]
|
73 |
for i in top_indices:
|
74 |
st.write(f"{model.classes_[i]}: {probabilities[i]:.2f}")
|
75 |
-
|
76 |
fig = plot_hand_landmarks(landmarks, "Detected Hand Landmarks")
|
77 |
st.pyplot(fig)
|
78 |
else:
|
@@ -96,7 +96,7 @@ with tab2:
|
|
96 |
try:
|
97 |
image = cv2.imread(image_path)
|
98 |
if image is not None:
|
99 |
-
probabilities, landmarks = process_and_predict(image
|
100 |
if landmarks is not None:
|
101 |
fig = plot_hand_landmarks(landmarks, f"Hand Landmarks for {alphabet}")
|
102 |
st.pyplot(fig)
|
|
|
63 |
col1, col2 = st.columns(2)
|
64 |
with col1:
|
65 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
66 |
+
|
67 |
+
probabilities, landmarks = process_and_predict(image)
|
68 |
+
|
69 |
if probabilities is not None and landmarks is not None:
|
70 |
with col2:
|
71 |
st.subheader("Top 5 Predictions:")
|
72 |
top_indices = np.argsort(probabilities)[::-1][:5]
|
73 |
for i in top_indices:
|
74 |
st.write(f"{model.classes_[i]}: {probabilities[i]:.2f}")
|
75 |
+
|
76 |
fig = plot_hand_landmarks(landmarks, "Detected Hand Landmarks")
|
77 |
st.pyplot(fig)
|
78 |
else:
|
|
|
96 |
try:
|
97 |
image = cv2.imread(image_path)
|
98 |
if image is not None:
|
99 |
+
probabilities, landmarks = process_and_predict(image)
|
100 |
if landmarks is not None:
|
101 |
fig = plot_hand_landmarks(landmarks, f"Hand Landmarks for {alphabet}")
|
102 |
st.pyplot(fig)
|