pszemraj commited on
Commit
895976b
β€’
1 Parent(s): 15c9486

πŸ’„ style update 3

Browse files

Signed-off-by: peter szemraj <peterszemraj@gmail.com>

Files changed (2) hide show
  1. app.py +4 -4
  2. utils.py +19 -2
app.py CHANGED
@@ -358,13 +358,13 @@ if __name__ == "__main__":
358
  )
359
 
360
  output_text = gr.HTML("<p><em>Output will appear below:</em></p>")
361
- gr.Markdown("### Summary Output")
362
  summary_text = gr.HTML(
363
  label="Summary", value="<i>Summary will appear here!</i>"
364
  )
365
  with gr.Column():
366
- gr.Markdown("Export & Summary Scores")
367
- with gr.Row(variant="panel"):
368
  with gr.Column(variant="compact"):
369
  text_file = gr.File(
370
  label="Download as Text File",
@@ -374,7 +374,7 @@ if __name__ == "__main__":
374
  )
375
  with gr.Column(variant="compact"):
376
  gr.Markdown(
377
- "The summary scores can be thought of as representing the quality of the summary. less-negative numbers (closer to 0) are better:"
378
  )
379
  summary_scores = gr.Textbox(
380
  label="Summary Scores",
 
358
  )
359
 
360
  output_text = gr.HTML("<p><em>Output will appear below:</em></p>")
361
+ gr.Markdown("### **Summary Output**")
362
  summary_text = gr.HTML(
363
  label="Summary", value="<i>Summary will appear here!</i>"
364
  )
365
  with gr.Column():
366
+ gr.Markdown("#### Export & Summary Scores")
367
+ with gr.Row():
368
  with gr.Column(variant="compact"):
369
  text_file = gr.File(
370
  label="Download as Text File",
 
374
  )
375
  with gr.Column(variant="compact"):
376
  gr.Markdown(
377
+ "The scores can be thought of as representing the quality of the summary. less-negative numbers (closer to 0) are better:"
378
  )
379
  summary_scores = gr.Textbox(
380
  label="Summary Scores",
utils.py CHANGED
@@ -107,7 +107,8 @@ def load_example_filenames(example_path: str or Path):
107
 
108
 
109
  def textlist2html(text_batches):
110
- html_list = [
 
111
  f"""
112
  <div style="
113
  margin-bottom: 20px;
@@ -121,7 +122,23 @@ def textlist2html(text_batches):
121
  """
122
  for i, s in enumerate(text_batches, start=1)
123
  ]
124
- return "\n".join(html_list)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
 
127
  def extract_keywords(
 
107
 
108
 
109
  def textlist2html(text_batches):
110
+ # Step 1: Generate each summary batch as a string of HTML
111
+ formatted_batches = [
112
  f"""
113
  <div style="
114
  margin-bottom: 20px;
 
122
  """
123
  for i, s in enumerate(text_batches, start=1)
124
  ]
125
+
126
+ # Step 2: Join all the summary batches together into one string
127
+ joined_batches = "".join(formatted_batches)
128
+
129
+ # Step 3: Wrap the summary string in a larger div with background color, border, and padding
130
+ text_html_block = f"""
131
+ <div style="
132
+ background-color: #f9f9f9;
133
+ border: 1px solid #ddd;
134
+ border-radius: 5px;
135
+ padding: 20px;
136
+ ">
137
+ {joined_batches}
138
+ </div>
139
+ """
140
+
141
+ return text_html_block
142
 
143
 
144
  def extract_keywords(