Spaces:
Sleeping
Sleeping
Update pages/Entorno de Ejecución.py
Browse files
pages/Entorno de Ejecución.py
CHANGED
@@ -45,7 +45,7 @@ with col_a:
|
|
45 |
ultra_flag = False
|
46 |
if ultra_button:
|
47 |
ultra_flag = True
|
48 |
-
|
49 |
|
50 |
# Create a dropdown menu to select the model
|
51 |
model_choice = st.multiselect("Seleccione uno o varios modelos de clasificación", model_dict.keys())
|
@@ -69,7 +69,7 @@ with col_a:
|
|
69 |
|
70 |
#for model in model_choice:
|
71 |
#selected_models.append(model)
|
72 |
-
|
73 |
|
74 |
# Set the image dimensions
|
75 |
IMAGE_WIDTH = IMAGE_HEIGHT = 224
|
@@ -80,7 +80,7 @@ with col_b:
|
|
80 |
if st.button('¿Hay un patacón en la imagen?'):
|
81 |
if len(selected_models) > 0 and ultra_flag:
|
82 |
st.write('Debe elegir un solo método: Ultra-Patacotrón o selección múltiple.')
|
83 |
-
elif uploaded_file is not None
|
84 |
# Load the image and resize it to the required dimensions
|
85 |
#img = tf.io.read_file(uploaded_file)
|
86 |
raw_img = tf.image.decode_image(uploaded_file.read(), channels=3)
|
@@ -92,14 +92,15 @@ with col_b:
|
|
92 |
#img = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT))
|
93 |
|
94 |
# Convert the image to RGB and preprocess it for the model
|
95 |
-
#img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
96 |
-
|
97 |
# Pass the image to the model and get the prediction
|
98 |
if ultra_flag:
|
99 |
with st.spinner('Cargando ultra-predicción...'):
|
|
|
100 |
y_gorrito = predict(ultraptctrn, img)
|
101 |
else:
|
102 |
with st.spinner('Cargando predicción...'):
|
|
|
103 |
y_gorrito = predict(selected_models, img)
|
104 |
|
105 |
if y_gorrito > threshold:
|
|
|
45 |
ultra_flag = False
|
46 |
if ultra_button:
|
47 |
ultra_flag = True
|
48 |
+
|
49 |
|
50 |
# Create a dropdown menu to select the model
|
51 |
model_choice = st.multiselect("Seleccione uno o varios modelos de clasificación", model_dict.keys())
|
|
|
69 |
|
70 |
#for model in model_choice:
|
71 |
#selected_models.append(model)
|
72 |
+
|
73 |
|
74 |
# Set the image dimensions
|
75 |
IMAGE_WIDTH = IMAGE_HEIGHT = 224
|
|
|
80 |
if st.button('¿Hay un patacón en la imagen?'):
|
81 |
if len(selected_models) > 0 and ultra_flag:
|
82 |
st.write('Debe elegir un solo método: Ultra-Patacotrón o selección múltiple.')
|
83 |
+
elif uploaded_file is not None:
|
84 |
# Load the image and resize it to the required dimensions
|
85 |
#img = tf.io.read_file(uploaded_file)
|
86 |
raw_img = tf.image.decode_image(uploaded_file.read(), channels=3)
|
|
|
92 |
#img = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT))
|
93 |
|
94 |
# Convert the image to RGB and preprocess it for the model
|
95 |
+
#img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
|
|
96 |
# Pass the image to the model and get the prediction
|
97 |
if ultra_flag:
|
98 |
with st.spinner('Cargando ultra-predicción...'):
|
99 |
+
ultraptctrn = [load_model(model_dict[model]) for model in ultraversions]
|
100 |
y_gorrito = predict(ultraptctrn, img)
|
101 |
else:
|
102 |
with st.spinner('Cargando predicción...'):
|
103 |
+
selected_models = [load_model(model_dict[model]) for model in model_choice]
|
104 |
y_gorrito = predict(selected_models, img)
|
105 |
|
106 |
if y_gorrito > threshold:
|