Spaces:
Runtime error
Runtime error
Commit
·
04de8b3
1
Parent(s):
fd4da82
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,17 @@ import numpy as np
|
|
| 7 |
|
| 8 |
model = tf.keras.models.load_model('modelo.h5')
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
file = st.file_uploader("Por favor suba una imagen de ropa (jpg, png, jpeg)", type=['jpg','png','jpeg'])
|
| 11 |
if file is not None:
|
| 12 |
bytes_data = file.read()
|
|
@@ -18,16 +29,16 @@ if file is not None:
|
|
| 18 |
x = np.squeeze(x)
|
| 19 |
x = np.expand_dims(x, axis=0)
|
| 20 |
prediction = model.predict(x)
|
| 21 |
-
|
| 22 |
-
|
|
|
|
| 23 |
col1, col2, col3 = st.columns(3)
|
| 24 |
-
|
| 25 |
with col1:
|
| 26 |
st.write("")
|
| 27 |
|
| 28 |
with col2:
|
| 29 |
image = Image.open(file)
|
| 30 |
-
st.markdown(
|
| 31 |
st.image(image,width=300)
|
| 32 |
|
| 33 |
with col3:
|
|
|
|
| 7 |
|
| 8 |
model = tf.keras.models.load_model('modelo.h5')
|
| 9 |
|
| 10 |
+
labels = ['Camiseta',
|
| 11 |
+
'Pantalon',
|
| 12 |
+
'Pull-over',
|
| 13 |
+
'Vestido',
|
| 14 |
+
'Abrigo',
|
| 15 |
+
'Sandalia',
|
| 16 |
+
'Camisa',
|
| 17 |
+
'Zapato',
|
| 18 |
+
'Bolso',
|
| 19 |
+
'Bota']
|
| 20 |
+
|
| 21 |
file = st.file_uploader("Por favor suba una imagen de ropa (jpg, png, jpeg)", type=['jpg','png','jpeg'])
|
| 22 |
if file is not None:
|
| 23 |
bytes_data = file.read()
|
|
|
|
| 29 |
x = np.squeeze(x)
|
| 30 |
x = np.expand_dims(x, axis=0)
|
| 31 |
prediction = model.predict(x)
|
| 32 |
+
index = numpy.argmax(prediction[0])
|
| 33 |
+
label = labels[index]
|
| 34 |
+
text = f"<p style='text-align: center;'>{label}</p>"
|
| 35 |
col1, col2, col3 = st.columns(3)
|
|
|
|
| 36 |
with col1:
|
| 37 |
st.write("")
|
| 38 |
|
| 39 |
with col2:
|
| 40 |
image = Image.open(file)
|
| 41 |
+
st.markdown(text,unsafe_allow_html=True)
|
| 42 |
st.image(image,width=300)
|
| 43 |
|
| 44 |
with col3:
|