Spaces:
Build error
Build error
Commit
·
e92eeea
1
Parent(s):
08cbfa1
Corregir error de indentación en la función stop_feature_camera()
Browse files- streamlit_app.py +2 -22
streamlit_app.py
CHANGED
|
@@ -590,26 +590,6 @@ def main():
|
|
| 590 |
st.session_state.feature_camera_running = True
|
| 591 |
|
| 592 |
def stop_feature_camera():
|
| 593 |
-
# Función auxiliar para verificar si una imagen es válida antes de redimensionar
|
| 594 |
-
def is_valid_image(img):
|
| 595 |
-
if img is None:
|
| 596 |
-
return False
|
| 597 |
-
try:
|
| 598 |
-
# Verificar que la imagen tenga dimensiones válidas y datos
|
| 599 |
-
return img.size > 0 and len(img.shape) >= 2 and img.shape[0] > 0 and img.shape[1] > 0
|
| 600 |
-
except:
|
| 601 |
-
return False
|
| 602 |
-
|
| 603 |
-
# Función auxiliar para redimensionar de forma segura
|
| 604 |
-
def safe_resize(img, target_size):
|
| 605 |
-
if is_valid_image(img):
|
| 606 |
-
try:
|
| 607 |
-
return cv2.resize(img, target_size)
|
| 608 |
-
except Exception as e:
|
| 609 |
-
print(f"Error al redimensionar: {str(e)}")
|
| 610 |
-
return None
|
| 611 |
-
return None
|
| 612 |
-
|
| 613 |
st.session_state.feature_camera_running = False
|
| 614 |
st.session_state.feature_camera_stopped = True
|
| 615 |
|
|
@@ -620,7 +600,7 @@ def main():
|
|
| 620 |
try:
|
| 621 |
# Verificar que la imagen tenga dimensiones válidas y datos
|
| 622 |
return img.size > 0 and len(img.shape) >= 2 and img.shape[0] > 0 and img.shape[1] > 0
|
| 623 |
-
except:
|
| 624 |
return False
|
| 625 |
|
| 626 |
# Función auxiliar para redimensionar de forma segura
|
|
@@ -629,7 +609,7 @@ def main():
|
|
| 629 |
try:
|
| 630 |
return cv2.resize(img, target_size)
|
| 631 |
except Exception as e:
|
| 632 |
-
|
| 633 |
return None
|
| 634 |
return None
|
| 635 |
|
|
|
|
| 590 |
st.session_state.feature_camera_running = True
|
| 591 |
|
| 592 |
def stop_feature_camera():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 593 |
st.session_state.feature_camera_running = False
|
| 594 |
st.session_state.feature_camera_stopped = True
|
| 595 |
|
|
|
|
| 600 |
try:
|
| 601 |
# Verificar que la imagen tenga dimensiones válidas y datos
|
| 602 |
return img.size > 0 and len(img.shape) >= 2 and img.shape[0] > 0 and img.shape[1] > 0
|
| 603 |
+
except Exception:
|
| 604 |
return False
|
| 605 |
|
| 606 |
# Función auxiliar para redimensionar de forma segura
|
|
|
|
| 609 |
try:
|
| 610 |
return cv2.resize(img, target_size)
|
| 611 |
except Exception as e:
|
| 612 |
+
print(f"Error al redimensionar: {str(e)}")
|
| 613 |
return None
|
| 614 |
return None
|
| 615 |
|