Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files
pages/Entorno de Ejecución.py
CHANGED
@@ -180,7 +180,7 @@ with vit:
|
|
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 |
-
|
184 |
|
185 |
|
186 |
#def vit_ensemble(classifier_list, img):
|
@@ -195,10 +195,9 @@ with vit:
|
|
195 |
|
196 |
#y_gorrito = query(uploaded_file.read(), model_choice[0])[1]["score"]
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
#y_gorrito /= len(model_choice)
|
202 |
|
203 |
#st.write("y gorrito calculado", len(model_choice))
|
204 |
#classifier = classifier(img)
|
@@ -216,7 +215,7 @@ with vit:
|
|
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(
|
220 |
else:
|
221 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|
222 |
|
|
|
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):
|
|
|
195 |
|
196 |
#y_gorrito = query(uploaded_file.read(), model_choice[0])[1]["score"]
|
197 |
|
198 |
+
for model in model_choice:
|
199 |
+
y_gorrito += query(uploaded_file.read(), model_dict[model])
|
200 |
+
y_gorrito /= len(model_choice)
|
|
|
201 |
|
202 |
#st.write("y gorrito calculado", len(model_choice))
|
203 |
#classifier = classifier(img)
|
|
|
215 |
else:
|
216 |
st.error("No se considera que haya un patacón en la imagen")
|
217 |
st.caption(f'La probabilidad de que la imagen tenga un patacón es del: {round(float(y_gorrito * 100), 2)}%')
|
218 |
+
st.image(img)
|
219 |
else:
|
220 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|
221 |
|