Spaces:
Build error
Build error
| import re | |
| # Leer el archivo | |
| with open('streamlit_app.py', 'r', encoding='utf-8') as file: | |
| lines = file.readlines() | |
| # Corregir la indentación - buscar la función stop_feature_camera y asegurarse de que tenga cuerpo | |
| fixed_lines = [] | |
| added_body = False | |
| i = 0 | |
| while i < len(lines): | |
| line = lines[i] | |
| fixed_lines.append(line) | |
| # Verificar si es la definición de la función stop_feature_camera | |
| if line.strip() == 'def stop_feature_camera():': | |
| # Verificar si la siguiente línea tiene indentación correcta | |
| if i + 1 < len(lines) and not lines[i + 1].startswith(' ' * 8): | |
| # No tiene indentación correcta, añadir el cuerpo de la función | |
| fixed_lines.append(' ' * 8 + 'st.session_state.feature_camera_running = False\n') | |
| fixed_lines.append(' ' * 8 + 'st.session_state.feature_camera_stopped = True\n') | |
| fixed_lines.append('\n') | |
| added_body = True | |
| i += 1 | |
| # Guardar el archivo corregido | |
| with open('streamlit_app.py', 'w', encoding='utf-8') as file: | |
| file.writelines(fixed_lines) | |
| print("Archivo corregido con éxito. Se ha arreglado la indentación de la función stop_feature_camera()") |