Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files- pages/Entorno de Ejecución.py +11 -11
pages/Entorno de Ejecución.py
CHANGED
@@ -183,19 +183,19 @@ with zero_shot:
|
|
183 |
zsloaded = True
|
184 |
with st.spinner('Cargando predicción...'):
|
185 |
img = preprocess(uploaded_file, module = 'pil')
|
186 |
-
|
187 |
candidate_labels = labels_for_classification)
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
else:
|
200 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|
201 |
|
|
|
183 |
zsloaded = True
|
184 |
with st.spinner('Cargando predicción...'):
|
185 |
img = preprocess(uploaded_file, module = 'pil')
|
186 |
+
zs_classifier = classifier(img,
|
187 |
candidate_labels = labels_for_classification)
|
188 |
|
189 |
+
for clase in zs_classifier:
|
190 |
+
if clase['label'] == 'A yellow deep fried smashed plantain':
|
191 |
+
y_gorrito = (clase["score"])
|
192 |
+
|
193 |
+
if round(float(y_gorrito*100)) >= threshold:
|
194 |
+
st.success("¡Patacón Detectado!")
|
195 |
+
else:
|
196 |
+
st.error("No se considera que haya un patacón en la imagen")
|
197 |
+
st.caption(f'La probabilidad de que la imagen tenga un patacón es del: {round(float(y_gorrito * 100), 2)}%')
|
198 |
+
st.image(img)
|
199 |
else:
|
200 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|
201 |
|