Spaces:
Sleeping
Sleeping
Update pages/Entorno de Ejecución.py
Browse files
pages/Entorno de Ejecución.py
CHANGED
|
@@ -175,12 +175,12 @@ with vit:
|
|
| 175 |
elif uploaded_file is not None:
|
| 176 |
with st.spinner('Cargando predicción...'):
|
| 177 |
|
| 178 |
-
|
| 179 |
|
| 180 |
#classifiers = [pipeline("image-classification", model= model_dict[model_choice[i]]) for i in range(len(model_choice))]
|
| 181 |
|
| 182 |
#classifier = pipeline("image-classification", model= model_dict[model_choice[0]])
|
| 183 |
-
#img = preprocess(uploaded_file, module = 'pil')
|
| 184 |
|
| 185 |
|
| 186 |
#def vit_ensemble(classifier_list, img):
|
|
@@ -209,15 +209,14 @@ with vit:
|
|
| 209 |
|
| 210 |
#y_gorrito = classifier[0]["score"]
|
| 211 |
|
| 212 |
-
st.write(api_result)
|
| 213 |
#y_gorrito = vit_ensemble(classifiers, img)
|
| 214 |
#
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
st.image(
|
| 221 |
else:
|
| 222 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|
| 223 |
|
|
|
|
| 175 |
elif uploaded_file is not None:
|
| 176 |
with st.spinner('Cargando predicción...'):
|
| 177 |
|
| 178 |
+
y_gorrito = query(uploaded_file.read(), model_dict[model_choice[0]])
|
| 179 |
|
| 180 |
#classifiers = [pipeline("image-classification", model= model_dict[model_choice[i]]) for i in range(len(model_choice))]
|
| 181 |
|
| 182 |
#classifier = pipeline("image-classification", model= model_dict[model_choice[0]])
|
| 183 |
+
##img = preprocess(uploaded_file, module = 'pil')
|
| 184 |
|
| 185 |
|
| 186 |
#def vit_ensemble(classifier_list, img):
|
|
|
|
| 209 |
|
| 210 |
#y_gorrito = classifier[0]["score"]
|
| 211 |
|
|
|
|
| 212 |
#y_gorrito = vit_ensemble(classifiers, img)
|
| 213 |
#
|
| 214 |
+
if round(float(y_gorrito * 100)) >= threshold:
|
| 215 |
+
st.success("¡Patacón Detectado!")
|
| 216 |
+
else:
|
| 217 |
+
st.error("No se considera que haya un patacón en la imagen")
|
| 218 |
+
st.caption(f'La probabilidad de que la imagen tenga un patacón es del: {round(float(y_gorrito * 100), 2)}%')
|
| 219 |
+
st.image(uploaded_file.read())
|
| 220 |
else:
|
| 221 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|
| 222 |
|