eberhenriquez94 commited on
Commit
b81ef43
verified
1 Parent(s): 4466e02
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -48,11 +48,10 @@ def flujo_principal(pdf_file, idioma="spa"):
48
  if not pdf_file:
49
  raise gr.Error("No se subi贸 ning煤n archivo.")
50
 
51
- # Crear archivos temporales para el procesamiento
52
- with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as temp_input:
53
- temp_input.write(pdf_file.read())
54
- input_pdf = temp_input.name
55
 
 
56
  with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as temp_output:
57
  output_pdf = temp_output.name
58
 
@@ -68,8 +67,6 @@ def flujo_principal(pdf_file, idioma="spa"):
68
  raise e
69
  finally:
70
  # Limpiar archivos temporales
71
- if os.path.exists(input_pdf):
72
- os.remove(input_pdf)
73
  if os.path.exists(output_pdf):
74
  os.remove(output_pdf)
75
 
@@ -100,4 +97,4 @@ with gr.Blocks() as interfaz:
100
  )
101
 
102
  if __name__ == "__main__":
103
- interfaz.launch()
 
48
  if not pdf_file:
49
  raise gr.Error("No se subi贸 ning煤n archivo.")
50
 
51
+ # Utilizar la ruta proporcionada por el archivo subido
52
+ input_pdf = pdf_file.name
 
 
53
 
54
+ # Crear un archivo temporal para la salida del OCR
55
  with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as temp_output:
56
  output_pdf = temp_output.name
57
 
 
67
  raise e
68
  finally:
69
  # Limpiar archivos temporales
 
 
70
  if os.path.exists(output_pdf):
71
  os.remove(output_pdf)
72
 
 
97
  )
98
 
99
  if __name__ == "__main__":
100
+ interfaz.launch()