Spaces:
Runtime error
Runtime error
Commit
·
69989c9
1
Parent(s):
36f3f59
Update app.py
Browse files
app.py
CHANGED
|
@@ -163,10 +163,35 @@ if uploaded_image is not None:
|
|
| 163 |
img = cv2.resize(img, (130, 130))
|
| 164 |
|
| 165 |
result = classify_image(get_b64_test_image_for_virat(), display_image)
|
|
|
|
| 166 |
try:
|
| 167 |
-
st.
|
| 168 |
-
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
|
| 172 |
|
|
|
|
| 163 |
img = cv2.resize(img, (130, 130))
|
| 164 |
|
| 165 |
result = classify_image(get_b64_test_image_for_virat(), display_image)
|
| 166 |
+
|
| 167 |
try:
|
| 168 |
+
col6,col7 = st.columns(2)
|
| 169 |
+
with col6:
|
| 170 |
+
st.header("Uploded Image: ")
|
| 171 |
+
st.image(img,width=130, caption='Uploaded Image')
|
| 172 |
+
with col7:
|
| 173 |
+
celeb = result[0]['class']
|
| 174 |
+
st.header("Predicted Image: ")
|
| 175 |
+
if celeb == "MS Dhoni":
|
| 176 |
+
dhoni = cv2.imread("dhoni.jpg")
|
| 177 |
+
st.image(dhoni,width=150, caption='MS Dhoni')
|
| 178 |
+
elif celeb == "Rahul Dravid":
|
| 179 |
+
dravid = cv2.imread("rahul.jpg")
|
| 180 |
+
st.image(dravid,width=150, caption='Rahul Dravid')
|
| 181 |
+
elif celeb == "Sachin Tendulkar":
|
| 182 |
+
sachin = cv2.imread("sachin.jpg")
|
| 183 |
+
st.image(sachin,width=150, caption='Sachin Tendulkar')
|
| 184 |
+
elif celeb == "Saurav Ganguly":
|
| 185 |
+
ganguly = cv2.imread("ganguly.jpg")
|
| 186 |
+
st.image(ganguly,width=150, caption='Saurav Ganguly')
|
| 187 |
+
elif celeb == "virat_kohli":
|
| 188 |
+
virat = cv2.imread("virat.jpg")
|
| 189 |
+
st.image(virat,width=150, caption='Virat Kohli')
|
| 190 |
+
elif celeb == "Virendra Sehwag":
|
| 191 |
+
sehwag = cv2.imread("sehwag.jpg")
|
| 192 |
+
st.image(virat,width=150, caption='Virendra Sehwag')
|
| 193 |
+
except:
|
| 194 |
+
st.header("Image Cannot be Classified!")
|
| 195 |
|
| 196 |
|
| 197 |
|