Paula Leonova commited on
Commit
1f1805f
1 Parent(s): 0473b75

Update description for summary generation

Browse files
Files changed (1) hide show
  1. app.py +22 -21
app.py CHANGED
@@ -61,27 +61,28 @@ if submit_button:
61
 
62
  with st.spinner('Generating summaries and matching labels...'):
63
  my_expander = st.expander(label='Expand to see summary generation details')
64
- with my_expander:
65
- # For each body of text, create text chunks of a certain token size required for the transformer
66
- nested_sentences = create_nest_sentences(document = text_input, token_max_length = 1024)
67
-
68
- summary = []
69
- # st.markdown("### Text Chunk & Summaries")
70
- st.markdown("_Breaks up the original text into sections with complete sentences totaling \
71
- less than 1024 tokens, a requirement for the summarizer._")
72
-
73
- # For each chunk of sentences (within the token max), generate a summary
74
- for n in range(0, len(nested_sentences)):
75
- text_chunk = " ".join(map(str, nested_sentences[n]))
76
- st.markdown(f"###### Original Text Chunk {n+1}/{len(nested_sentences)}" )
77
- st.markdown(text_chunk)
78
-
79
- chunk_summary = summarizer_gen(summarizer, sequence=text_chunk, maximum_tokens = 300, minimum_tokens = 20)
80
- summary.append(chunk_summary)
81
- st.markdown(f"###### Partial Summary {n+1}/{len(nested_sentences)}")
82
- st.markdown(chunk_summary)
83
- # Combine all the summaries into a list and compress into one document, again
84
- final_summary = " \n\n".join(list(summary))
 
85
 
86
  # final_summary = summarizer_gen(summarizer, sequence=text_input, maximum_tokens = 30, minimum_tokens = 100)
87
  st.markdown("### Combined Summary")
61
 
62
  with st.spinner('Generating summaries and matching labels...'):
63
  my_expander = st.expander(label='Expand to see summary generation details')
64
+ with my_expander:
65
+ # For each body of text, create text chunks of a certain token size required for the transformer
66
+ nested_sentences = create_nest_sentences(document = text_input, token_max_length = 1024)
67
+
68
+ summary = []
69
+ # st.markdown("### Text Chunk & Summaries")
70
+ st.markdown("_Breaks up the original text into sections with complete sentences totaling \
71
+ less than 1024 tokens, a requirement for the summarizer. Each block of text is than summarized separately \
72
+ and then combined at the very end to generate the final summary._")
73
+
74
+ # For each chunk of sentences (within the token max), generate a summary
75
+ for n in range(0, len(nested_sentences)):
76
+ text_chunk = " ".join(map(str, nested_sentences[n]))
77
+ st.markdown(f"###### Original Text Chunk {n+1}/{len(nested_sentences)}" )
78
+ st.markdown(text_chunk)
79
+
80
+ chunk_summary = summarizer_gen(summarizer, sequence=text_chunk, maximum_tokens = 300, minimum_tokens = 20)
81
+ summary.append(chunk_summary)
82
+ st.markdown(f"###### Partial Summary {n+1}/{len(nested_sentences)}")
83
+ st.markdown(chunk_summary)
84
+ # Combine all the summaries into a list and compress into one document, again
85
+ final_summary = " \n\n".join(list(summary))
86
 
87
  # final_summary = summarizer_gen(summarizer, sequence=text_input, maximum_tokens = 30, minimum_tokens = 100)
88
  st.markdown("### Combined Summary")