pszemraj commited on
Commit
0f39362
โ€ข
1 Parent(s): c13ffb4

๐Ÿ’„ restructure menu

Browse files

Signed-off-by: peter szemraj <[email protected]>

Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import contextlib
2
  import logging
 
3
  import re
4
  import time
5
  from pathlib import Path
@@ -203,7 +204,7 @@ if __name__ == "__main__":
203
  name_to_path = load_example_filenames(_here / "examples")
204
  logging.info(f"Loaded {len(name_to_path)} examples")
205
  demo = gr.Blocks()
206
-
207
  with demo:
208
 
209
  gr.Markdown("# Document Summarization with Long-Document Transformers")
@@ -227,28 +228,27 @@ if __name__ == "__main__":
227
  )
228
 
229
  with gr.Row():
 
230
  example_name = gr.Dropdown(
231
- list(name_to_path.keys()),
232
- label="Choose an Example",
 
233
  )
234
- load_examples_button = gr.Button(
235
- "Load Example",
236
- )
237
- input_text = gr.Textbox(
238
- lines=6,
239
- label="Input Text (for summarization)",
240
- placeholder="Enter text to summarize, the text will be cleaned and truncated on Spaces. Narrative, academic (both papers and lecture transcription), and article text work well. May take a bit to generate depending on the input text :)",
241
- )
242
- gr.Markdown("Upload a file (`.txt` or `.pdf`)")
243
- with gr.Row():
244
  uploaded_file = gr.File(
245
- label="Upload file",
246
  file_count="single",
247
  type="file",
248
  )
249
- load_file_button = gr.Button("Load Uploaded File")
250
-
251
- gr.Markdown("---")
 
 
 
 
 
 
 
252
 
253
  with gr.Column():
254
  gr.Markdown("## Generate Summary")
 
1
  import contextlib
2
  import logging
3
+ import random
4
  import re
5
  import time
6
  from pathlib import Path
 
204
  name_to_path = load_example_filenames(_here / "examples")
205
  logging.info(f"Loaded {len(name_to_path)} examples")
206
  demo = gr.Blocks()
207
+ _examples = list(name_to_path.keys())
208
  with demo:
209
 
210
  gr.Markdown("# Document Summarization with Long-Document Transformers")
 
228
  )
229
 
230
  with gr.Row():
231
+ gr.Markdown("Select an example, or ppload a file (`.txt` or `.pdf`)")
232
  example_name = gr.Dropdown(
233
+ _examples,
234
+ label="Examples",
235
+ value=random.choice(_examples),
236
  )
 
 
 
 
 
 
 
 
 
 
237
  uploaded_file = gr.File(
238
+ label="File Upload",
239
  file_count="single",
240
  type="file",
241
  )
242
+ with gr.Row():
243
+ input_text = gr.Textbox(
244
+ lines=4,
245
+ label="Input Text (for summarization)",
246
+ placeholder="Enter text to summarize, the text will be cleaned and truncated on Spaces. Narrative, academic (both papers and lecture transcription), and article text work well. May take a bit to generate depending on the input text :)",
247
+ )
248
+ load_examples_button = gr.Button(
249
+ "Load Example",
250
+ )
251
+ load_file_button = gr.Button("Upload File")
252
 
253
  with gr.Column():
254
  gr.Markdown("## Generate Summary")