Marroco93 commited on
Commit
98648e1
·
1 Parent(s): d33d65c

no message

Browse files
Files changed (1) hide show
  1. main.py +4 -0
main.py CHANGED
@@ -99,11 +99,15 @@ def split_text_by_tokens(text, max_tokens=1024):
99
  def summarize_large_text(text):
100
  chunks, token_counts = split_text_by_tokens(text, max_tokens=1024 - 10) # Slight buffer to avoid edge cases
101
  summaries = []
 
 
102
  for chunk in chunks:
 
103
  # Perform summarization on the chunk
104
  summary = summarizer(chunk, max_length=500, min_length=100, do_sample=False)
105
  if summary:
106
  summaries.append(summary[0]['summary_text'])
 
107
  combined_summary = ' '.join(summaries)
108
  return combined_summary
109
 
 
99
  def summarize_large_text(text):
100
  chunks, token_counts = split_text_by_tokens(text, max_tokens=1024 - 10) # Slight buffer to avoid edge cases
101
  summaries = []
102
+ print("Starting summarization of chunks...")
103
+
104
  for chunk in chunks:
105
+ print(f"Summarizing chunk: {chunk[:50]}...") # Print the first 50 characters of the chunk
106
  # Perform summarization on the chunk
107
  summary = summarizer(chunk, max_length=500, min_length=100, do_sample=False)
108
  if summary:
109
  summaries.append(summary[0]['summary_text'])
110
+ print(f"Summary: {summary[0]['summary_text'][:50]}") # Print the first 50 characters of the summary
111
  combined_summary = ' '.join(summaries)
112
  return combined_summary
113