Spaces:
Running
Running
Commit
路
176f9a1
1
Parent(s):
85dbeb5
Fix image comparison display and remove deprecated parameter warning
Browse files- streamlit_app.py +27 -21
streamlit_app.py
CHANGED
|
@@ -2002,29 +2002,35 @@ def main():
|
|
| 2002 |
st.write("Below you can see each detected face alongside its match in the database:")
|
| 2003 |
|
| 2004 |
for idx, match_info in enumerate(st.session_state.matched_faces):
|
| 2005 |
-
# Crear
|
| 2006 |
-
|
| 2007 |
|
| 2008 |
-
#
|
| 2009 |
-
with
|
| 2010 |
-
st.
|
| 2011 |
-
caption=f"Detected Face #{idx+1}",
|
| 2012 |
-
use_column_width=True)
|
| 2013 |
-
|
| 2014 |
-
# Mostrar imagen de referencia si existe
|
| 2015 |
-
with comp_col2:
|
| 2016 |
-
# Obtener la primera imagen de referencia de la carpeta de la base de datos si existe
|
| 2017 |
-
reference_name = match_info["matched_name"]
|
| 2018 |
-
st.write(f"Match: **{reference_name}** ({match_info['similarity']:.1f}%)")
|
| 2019 |
|
| 2020 |
-
#
|
| 2021 |
-
|
| 2022 |
-
|
| 2023 |
-
st.image(
|
| 2024 |
-
|
| 2025 |
-
|
| 2026 |
-
|
| 2027 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2028 |
|
| 2029 |
# Limpiar el estado para la pr贸xima ejecuci贸n
|
| 2030 |
del st.session_state.matched_faces
|
|
|
|
| 2002 |
st.write("Below you can see each detected face alongside its match in the database:")
|
| 2003 |
|
| 2004 |
for idx, match_info in enumerate(st.session_state.matched_faces):
|
| 2005 |
+
# Crear contenedor para la comparaci贸n
|
| 2006 |
+
comparison_container = st.container()
|
| 2007 |
|
| 2008 |
+
# Crear columnas dentro del contenedor
|
| 2009 |
+
with comparison_container:
|
| 2010 |
+
comp_col1, comp_col2 = st.columns(2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2011 |
|
| 2012 |
+
# Mostrar el rostro detectado
|
| 2013 |
+
with comp_col1:
|
| 2014 |
+
st.write(f"**Detected Face #{idx+1}**")
|
| 2015 |
+
st.image(
|
| 2016 |
+
cv2.cvtColor(match_info["face_crop"], cv2.COLOR_BGR2RGB),
|
| 2017 |
+
width=250 # Usar ancho fijo en lugar de use_column_width
|
| 2018 |
+
)
|
| 2019 |
+
|
| 2020 |
+
# Mostrar imagen de referencia si existe
|
| 2021 |
+
with comp_col2:
|
| 2022 |
+
reference_name = match_info["matched_name"]
|
| 2023 |
+
st.write(f"**Match: {reference_name}** ({match_info['similarity']:.1f}%)")
|
| 2024 |
+
|
| 2025 |
+
# Intentar mostrar la imagen de referencia guardada
|
| 2026 |
+
if reference_name in st.session_state.face_database and 'face_image' in st.session_state.face_database[reference_name]:
|
| 2027 |
+
reference_image = st.session_state.face_database[reference_name]['face_image']
|
| 2028 |
+
st.image(
|
| 2029 |
+
cv2.cvtColor(reference_image, cv2.COLOR_BGR2RGB),
|
| 2030 |
+
width=250 # Usar ancho fijo en lugar de use_column_width
|
| 2031 |
+
)
|
| 2032 |
+
else:
|
| 2033 |
+
st.info(f"The reference image for {reference_name} is not available. Please re-register this person to see their image here.")
|
| 2034 |
|
| 2035 |
# Limpiar el estado para la pr贸xima ejecuci贸n
|
| 2036 |
del st.session_state.matched_faces
|