jarondon82 commited on
Commit
516309b
·
1 Parent(s): fb3e27a

Corregir error de variable result_image no inicializada

Browse files
Files changed (1) hide show
  1. streamlit_app.py +6 -3
streamlit_app.py CHANGED
@@ -1835,6 +1835,8 @@ def main():
1835
 
1836
  if not bboxes:
1837
  st.error("No se detectaron rostros en la imagen.")
 
 
1838
  else:
1839
  # Mostrar imagen con rostros detectados
1840
  st.image(processed_image, channels='BGR', caption="Faces detected")
@@ -1965,9 +1967,10 @@ def main():
1965
  f"{matches[0]['similarity']:.1f}%" if matches else "N/A"
1966
  )
1967
 
1968
- # Mostrar resultado
1969
- st.subheader("Recognition Result")
1970
- st.image(result_image, channels='BGR', use_container_width=True)
 
1971
 
1972
  with tab3:
1973
  st.header("Real-time Recognition")
 
1835
 
1836
  if not bboxes:
1837
  st.error("No se detectaron rostros en la imagen.")
1838
+ # Inicializar result_image aunque no haya rostros
1839
+ result_image = image.copy()
1840
  else:
1841
  # Mostrar imagen con rostros detectados
1842
  st.image(processed_image, channels='BGR', caption="Faces detected")
 
1967
  f"{matches[0]['similarity']:.1f}%" if matches else "N/A"
1968
  )
1969
 
1970
+ # Mostrar resultado solo si hay una imagen cargada
1971
+ if uploaded_file is not None:
1972
+ st.subheader("Recognition Result")
1973
+ st.image(result_image, channels='BGR', use_container_width=True)
1974
 
1975
  with tab3:
1976
  st.header("Real-time Recognition")