Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,12 +76,16 @@ def summarize_news(query, num_results=3):
|
|
76 |
try:
|
77 |
summaries = summarizer(chunks, max_length=120, min_length=30, do_sample=False)
|
78 |
summary_text = " ".join([summary['summary_text'] for summary in summaries])
|
|
|
|
|
|
|
|
|
79 |
except Exception as e:
|
80 |
logging.error(f"Error during summarization: {e}")
|
81 |
-
|
82 |
|
83 |
-
logging.debug(f"Final summarized text: {
|
84 |
-
return
|
85 |
|
86 |
iface = gr.Interface(
|
87 |
fn=summarize_news,
|
|
|
76 |
try:
|
77 |
summaries = summarizer(chunks, max_length=120, min_length=30, do_sample=False)
|
78 |
summary_text = " ".join([summary['summary_text'] for summary in summaries])
|
79 |
+
|
80 |
+
# Reprocess the generated summary
|
81 |
+
logging.debug("Reprocessing the summary for cohesiveness and elaboration...")
|
82 |
+
final_summary = summarizer(summary_text, max_length=150, min_length=60, do_sample=False)[0]['summary_text']
|
83 |
except Exception as e:
|
84 |
logging.error(f"Error during summarization: {e}")
|
85 |
+
final_summary = "An error occurred during summarization."
|
86 |
|
87 |
+
logging.debug(f"Final summarized text: {final_summary}")
|
88 |
+
return final_summary
|
89 |
|
90 |
iface = gr.Interface(
|
91 |
fn=summarize_news,
|