Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,13 +21,17 @@ def process_file(file):
|
|
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 |
preprocessor = Preprocessor()
|
25 |
|
|
|
26 |
if file is not None:
|
27 |
-
|
28 |
-
input_text = pdf_processor.pdf_to_text(file.name)
|
29 |
|
30 |
-
|
|
|
31 |
return "Por favor, ingrese texto o cargue un archivo v谩lido."
|
32 |
|
33 |
cleaned_text = preprocessor.clean_text(input_text)
|
|
|
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 |
+
input_text = PDFProcessor.process_file(file)
|
|
|
32 |
|
33 |
+
# Validar que haya texto para resumir
|
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)
|