Blaise-g commited on
Commit
5fc3cab
β€’
1 Parent(s): 3a752aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -17
app.py CHANGED
@@ -95,14 +95,20 @@ def proc_submission(
95
  #tokenizer_led_det if (model_type == "LED") else tokenizer_det,
96
  #batch_length=token_batch_length,
97
  #**settings_det,
98
- #)
 
 
 
 
 
99
  _summaries = summarize_via_tokenbatches(
100
  tr_in,
101
  model_tldr if (summary_type == "TLDR") else model_det,
102
  tokenizer_tldr if (summary_type == "TLDR") else tokenizer_det,
103
  batch_length=token_batch_length,
104
- **settings_tldr,# if (summary_type == "TLDR") else **settings_det,
105
  )
 
106
  sum_text = [f"Section {i}: " + s["summary"][0] for i, s in enumerate(_summaries)]
107
  compression_rate = [
108
  f" - Section {i}: {round(s['compression_rate'],3)}"
@@ -192,7 +198,7 @@ if __name__ == "__main__":
192
  )
193
  with gr.Row():
194
  summary_type = gr.Radio(
195
- choices=["TLDR", "Detailed"], label="Summary Type", value="Detailed"
196
  )
197
  model_type = gr.Radio(
198
  choices=["LongT5", "LED"], label="Model Architecture", value="LongT5"
@@ -216,22 +222,9 @@ if __name__ == "__main__":
216
  token_batch_length = gr.Radio(
217
  choices=[512, 768, 1024],
218
  label="token batch length",
219
- value=512,
220
  )
221
 
222
- #with gr.Row():
223
- #repetition_penalty = gr.inputs.Slider(
224
- #minimum=1.0,
225
- #maximum=5.0,
226
- #label="repetition penalty",
227
- #default=3.5,
228
- #step=0.1,
229
- #)
230
- #no_repeat_ngram_size = gr.Radio(
231
- #choices=[2, 3, 4],
232
- #label="no repeat ngram size",
233
- #value=3,
234
- # )
235
  with gr.Row():
236
  example_name = gr.Dropdown(
237
  list(name_to_path.keys()),
 
95
  #tokenizer_led_det if (model_type == "LED") else tokenizer_det,
96
  #batch_length=token_batch_length,
97
  #**settings_det,
98
+ #)
99
+ if summary_type == 'TLDR':
100
+ settings = settings_tldr
101
+ elif summary types == 'Detailed':
102
+ settings = settings_det
103
+
104
  _summaries = summarize_via_tokenbatches(
105
  tr_in,
106
  model_tldr if (summary_type == "TLDR") else model_det,
107
  tokenizer_tldr if (summary_type == "TLDR") else tokenizer_det,
108
  batch_length=token_batch_length,
109
+ **settings,
110
  )
111
+
112
  sum_text = [f"Section {i}: " + s["summary"][0] for i, s in enumerate(_summaries)]
113
  compression_rate = [
114
  f" - Section {i}: {round(s['compression_rate'],3)}"
 
198
  )
199
  with gr.Row():
200
  summary_type = gr.Radio(
201
+ choices=["TLDR", "Detailed"], label="Summary Type", value="TLDR"
202
  )
203
  model_type = gr.Radio(
204
  choices=["LongT5", "LED"], label="Model Architecture", value="LongT5"
 
222
  token_batch_length = gr.Radio(
223
  choices=[512, 768, 1024],
224
  label="token batch length",
225
+ value=1024,
226
  )
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  with gr.Row():
229
  example_name = gr.Dropdown(
230
  list(name_to_path.keys()),