Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import tempfile
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def procesar_bases(file1, file2):
|
| 6 |
try:
|
|
@@ -120,19 +122,18 @@ def procesar_bases(file1, file2):
|
|
| 120 |
|
| 121 |
|
| 122 |
# --- Existing code ends here ---
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
dff_expanded_final.to_excel(temp1.name, index=False, engine='openpyxl')
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
empty_concepto_2.to_excel(
|
| 134 |
|
| 135 |
-
return
|
| 136 |
|
| 137 |
except Exception as e:
|
| 138 |
return f"❌ Error: {str(e)}", None, None
|
|
@@ -151,4 +152,4 @@ gr.Interface(
|
|
| 151 |
],
|
| 152 |
title="Limpieza de la base Facturas y Partidas",
|
| 153 |
description="Instrucciones: Sube dos archivos de Excel. El primero debe ser la base de 'Facturas', el segundo la base de 'Partidas'. El sistema devuelve tres archivos procesados, la base de Facturas, Partidas, y una base con las Partidas que deben ser agregadas manualmente."
|
| 154 |
-
).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import tempfile
|
| 4 |
+
import os
|
| 5 |
+
import uuid
|
| 6 |
|
| 7 |
def procesar_bases(file1, file2):
|
| 8 |
try:
|
|
|
|
| 122 |
|
| 123 |
|
| 124 |
# --- Existing code ends here ---
|
| 125 |
+
# Guardamos archivos en rutas persistentes
|
| 126 |
+
os.makedirs("outputs", exist_ok=True) # Crear carpeta outputs si no existe
|
|
|
|
| 127 |
|
| 128 |
+
output1 = f"outputs/facturas_limpias_{uuid.uuid4().hex}.xlsx"
|
| 129 |
+
output2 = f"outputs/partidas_limpias_{uuid.uuid4().hex}.xlsx"
|
| 130 |
+
output3 = f"outputs/partidas_manuales_{uuid.uuid4().hex}.xlsx"
|
| 131 |
|
| 132 |
+
dff_expanded_final.to_excel(output1, index=False, engine='openpyxl')
|
| 133 |
+
dfp_expanded_final.to_excel(output2, index=False, engine='openpyxl')
|
| 134 |
+
empty_concepto_2.to_excel(output3, index=False, engine='openpyxl')
|
| 135 |
|
| 136 |
+
return output1, output2, output3
|
| 137 |
|
| 138 |
except Exception as e:
|
| 139 |
return f"❌ Error: {str(e)}", None, None
|
|
|
|
| 152 |
],
|
| 153 |
title="Limpieza de la base Facturas y Partidas",
|
| 154 |
description="Instrucciones: Sube dos archivos de Excel. El primero debe ser la base de 'Facturas', el segundo la base de 'Partidas'. El sistema devuelve tres archivos procesados, la base de Facturas, Partidas, y una base con las Partidas que deben ser agregadas manualmente."
|
| 155 |
+
).launch()
|