Update app.py
Browse files
app.py
CHANGED
|
@@ -187,10 +187,11 @@ st.header("1. Escaneo de Habitación")
|
|
| 187 |
# 1. Selector de carga manual
|
| 188 |
uploaded_file = st.file_uploader("Sube tu imagen panorámica (360)", type=['jpg', 'png', 'jpeg'])
|
| 189 |
|
| 190 |
-
#
|
| 191 |
selected_example_path = st.session_state.get('selected_example_path', None)
|
| 192 |
selected_example_name = st.session_state.get('selected_example_name', None)
|
| 193 |
|
|
|
|
| 194 |
if uploaded_file is not None:
|
| 195 |
source_file = uploaded_file
|
| 196 |
file_caption = 'Imagen subida'
|
|
@@ -214,16 +215,19 @@ if source_file is not None:
|
|
| 214 |
|
| 215 |
if st.button("Analizar la habitación"):
|
| 216 |
with st.spinner("Detectando la geometría..."):
|
| 217 |
-
|
| 218 |
-
#
|
| 219 |
if isinstance(source_file, str):
|
|
|
|
| 220 |
temp_file_path = source_file
|
| 221 |
-
# Si es un archivo subido, guardamos el buffer para procesar
|
| 222 |
else:
|
|
|
|
| 223 |
temp_file_path = "temp_pano.jpg"
|
| 224 |
with open(temp_file_path, "wb") as f:
|
| 225 |
f.write(source_file.getbuffer())
|
| 226 |
-
|
|
|
|
|
|
|
| 227 |
# Instanciar y ejecutar el detector de layout (HorizonNet)
|
| 228 |
try:
|
| 229 |
# 🛑 USAR LA RUTA TEMPORAL GUARDADA EN session_state
|
|
|
|
| 187 |
# 1. Selector de carga manual
|
| 188 |
uploaded_file = st.file_uploader("Sube tu imagen panorámica (360)", type=['jpg', 'png', 'jpeg'])
|
| 189 |
|
| 190 |
+
# Obtener rutas de archivos de ejemplo desde session_state (definidas en la barra lateral)
|
| 191 |
selected_example_path = st.session_state.get('selected_example_path', None)
|
| 192 |
selected_example_name = st.session_state.get('selected_example_name', None)
|
| 193 |
|
| 194 |
+
# Determinar qué archivo usar (la carga manual tiene prioridad)
|
| 195 |
if uploaded_file is not None:
|
| 196 |
source_file = uploaded_file
|
| 197 |
file_caption = 'Imagen subida'
|
|
|
|
| 215 |
|
| 216 |
if st.button("Analizar la habitación"):
|
| 217 |
with st.spinner("Detectando la geometría..."):
|
| 218 |
+
|
| 219 |
+
# --- MANEJO DEL ARCHIVO TEMPORAL PARA EL DETECTOR ---
|
| 220 |
if isinstance(source_file, str):
|
| 221 |
+
# Si es un archivo de disco (ejemplo), ya tiene ruta
|
| 222 |
temp_file_path = source_file
|
|
|
|
| 223 |
else:
|
| 224 |
+
# Si es un archivo subido, guardamos el buffer para procesar
|
| 225 |
temp_file_path = "temp_pano.jpg"
|
| 226 |
with open(temp_file_path, "wb") as f:
|
| 227 |
f.write(source_file.getbuffer())
|
| 228 |
+
# --- FIN MANEJO ARCHIVO TEMPORAL ---
|
| 229 |
+
|
| 230 |
+
|
| 231 |
# Instanciar y ejecutar el detector de layout (HorizonNet)
|
| 232 |
try:
|
| 233 |
# 🛑 USAR LA RUTA TEMPORAL GUARDADA EN session_state
|