Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,26 +12,18 @@ def process_file(file):
|
|
12 |
if file is not None:
|
13 |
pdf_processor = PDFProcessor()
|
14 |
input_text = pdf_processor.pdf_to_text(file.name)
|
15 |
-
|
16 |
-
# Limpieza de archivos temporales despu茅s de procesar
|
17 |
-
PDFProcessor.clear_temp_directory()
|
18 |
-
|
19 |
return input_text
|
20 |
return "Por favor, cargue un archivo v谩lido."
|
21 |
|
22 |
# Funci贸n principal para generar res煤menes
|
23 |
def summarize(input_text, file, summary_type, method, num_sentences, model_name, max_length, num_beams):
|
24 |
-
"""
|
25 |
-
Genera un resumen basado en el texto de entrada o archivo cargado.
|
26 |
-
"""
|
27 |
preprocessor = Preprocessor()
|
28 |
|
29 |
-
# Procesar archivo si se sube uno
|
30 |
if file is not None:
|
31 |
-
|
|
|
32 |
|
33 |
-
|
34 |
-
if not input_text.strip():
|
35 |
return "Por favor, ingrese texto o cargue un archivo v谩lido."
|
36 |
|
37 |
cleaned_text = preprocessor.clean_text(input_text)
|
@@ -184,7 +176,4 @@ with gr.Blocks() as interface:
|
|
184 |
)
|
185 |
|
186 |
if __name__ == "__main__":
|
187 |
-
# Limpiar archivos temporales antes de lanzar la aplicaci贸n
|
188 |
-
PDFProcessor.clear_temp_directory()
|
189 |
-
|
190 |
interface.launch()
|
|
|
12 |
if file is not None:
|
13 |
pdf_processor = PDFProcessor()
|
14 |
input_text = pdf_processor.pdf_to_text(file.name)
|
|
|
|
|
|
|
|
|
15 |
return input_text
|
16 |
return "Por favor, cargue un archivo v谩lido."
|
17 |
|
18 |
# Funci贸n principal para generar res煤menes
|
19 |
def summarize(input_text, file, summary_type, method, num_sentences, model_name, max_length, num_beams):
|
|
|
|
|
|
|
20 |
preprocessor = Preprocessor()
|
21 |
|
|
|
22 |
if file is not None:
|
23 |
+
pdf_processor = PDFProcessor()
|
24 |
+
input_text = pdf_processor.pdf_to_text(file.name)
|
25 |
|
26 |
+
if not input_text:
|
|
|
27 |
return "Por favor, ingrese texto o cargue un archivo v谩lido."
|
28 |
|
29 |
cleaned_text = preprocessor.clean_text(input_text)
|
|
|
176 |
)
|
177 |
|
178 |
if __name__ == "__main__":
|
|
|
|
|
|
|
179 |
interface.launch()
|