jhj0517 commited on
Commit
adab100
·
1 Parent(s): f24a6e8

fix None value bug in Number

Browse files
Files changed (1) hide show
  1. app.py +29 -27
app.py CHANGED
@@ -125,28 +125,28 @@ class App:
125
  info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
126
  nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=0, precision=0,
127
  info="Prevent repetitions of n-grams with this size (set 0 to disable).")
128
- tb_prefix = gr.Textbox(label="Prefix", value=None,
129
  info="Optional text to provide as a prefix for the first window.")
130
  cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=True,
131
  info="Suppress blank outputs at the beginning of the sampling.")
132
- tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value="-1",
133
  info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
134
  nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=1.0,
135
  info="The initial timestamp cannot be later than this.")
136
  cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=False,
137
  info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
138
  tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value="\"'“¿([{-",
139
- info="If word_timestamps is True, merge these punctuation symbols with the next word.")
140
  tb_append_punctuations = gr.Textbox(label="Append Punctuations",
141
  value="\"'.。,,!!??::”)]}、",
142
- info="If word_timestamps is True, merge these punctuation symbols with the previous word.")
143
- nb_max_new_tokens = gr.Number(label="Max New Tokens", value=None, precision=0,
144
  info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
145
- nb_chunk_length = gr.Number(label="Chunk Length", value=None, precision=0,
146
  info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
147
- nb_hallucination_silence_threshold = gr.Number(label="Hallucination Silence Threshold",
148
- value=None,
149
- info="When word_timestamps is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
150
  tb_hotwords = gr.Textbox(label="Hotwords", value=None,
151
  info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
152
  nb_language_detection_threshold = gr.Number(label="Language Detection Threshold",
@@ -279,28 +279,29 @@ class App:
279
  info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
280
  nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=0, precision=0,
281
  info="Prevent repetitions of n-grams with this size (set 0 to disable).")
282
- tb_prefix = gr.Textbox(label="Prefix", value=None,
283
  info="Optional text to provide as a prefix for the first window.")
284
  cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=True,
285
  info="Suppress blank outputs at the beginning of the sampling.")
286
- tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value="-1",
287
  info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
288
  nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=1.0,
289
  info="The initial timestamp cannot be later than this.")
290
  cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=False,
291
  info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
292
  tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value="\"'“¿([{-",
293
- info="If word_timestamps is True, merge these punctuation symbols with the next word.")
294
  tb_append_punctuations = gr.Textbox(label="Append Punctuations",
295
  value="\"'.。,,!!??::”)]}、",
296
- info="If word_timestamps is True, merge these punctuation symbols with the previous word.")
297
- nb_max_new_tokens = gr.Number(label="Max New Tokens", value=None, precision=0,
298
  info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
299
- nb_chunk_length = gr.Number(label="Chunk Length", value=None, precision=0,
300
  info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
301
- nb_hallucination_silence_threshold = gr.Number(label="Hallucination Silence Threshold",
302
- value=None,
303
- info="When word_timestamps is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
 
304
  tb_hotwords = gr.Textbox(label="Hotwords", value=None,
305
  info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
306
  nb_language_detection_threshold = gr.Number(label="Language Detection Threshold",
@@ -425,28 +426,29 @@ class App:
425
  info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
426
  nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=0, precision=0,
427
  info="Prevent repetitions of n-grams with this size (set 0 to disable).")
428
- tb_prefix = gr.Textbox(label="Prefix", value=None,
429
  info="Optional text to provide as a prefix for the first window.")
430
  cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=True,
431
  info="Suppress blank outputs at the beginning of the sampling.")
432
- tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value="-1",
433
  info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
434
  nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=1.0,
435
  info="The initial timestamp cannot be later than this.")
436
  cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=False,
437
  info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
438
  tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value="\"'“¿([{-",
439
- info="If word_timestamps is True, merge these punctuation symbols with the next word.")
440
  tb_append_punctuations = gr.Textbox(label="Append Punctuations",
441
  value="\"'.。,,!!??::”)]}、",
442
- info="If word_timestamps is True, merge these punctuation symbols with the previous word.")
443
- nb_max_new_tokens = gr.Number(label="Max New Tokens", value=None, precision=0,
444
  info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
445
- nb_chunk_length = gr.Number(label="Chunk Length", value=None, precision=0,
446
  info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
447
- nb_hallucination_silence_threshold = gr.Number(label="Hallucination Silence Threshold",
448
- value=None,
449
- info="When word_timestamps is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
 
450
  tb_hotwords = gr.Textbox(label="Hotwords", value=None,
451
  info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
452
  nb_language_detection_threshold = gr.Number(label="Language Detection Threshold",
 
125
  info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
126
  nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=0, precision=0,
127
  info="Prevent repetitions of n-grams with this size (set 0 to disable).")
128
+ tb_prefix = gr.Textbox(label="Prefix", value=lambda: None, # Bug Fix https://github.com/gradio-app/gradio/issues/6728
129
  info="Optional text to provide as a prefix for the first window.")
130
  cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=True,
131
  info="Suppress blank outputs at the beginning of the sampling.")
132
+ tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value="[-1]",
133
  info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
134
  nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=1.0,
135
  info="The initial timestamp cannot be later than this.")
136
  cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=False,
137
  info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
138
  tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value="\"'“¿([{-",
139
+ info="If 'Word Timestamps' is True, merge these punctuation symbols with the next word.")
140
  tb_append_punctuations = gr.Textbox(label="Append Punctuations",
141
  value="\"'.。,,!!??::”)]}、",
142
+ info="If 'Word Timestamps' is True, merge these punctuation symbols with the previous word.")
143
+ nb_max_new_tokens = gr.Number(label="Max New Tokens", value=lambda: None, precision=0,
144
  info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
145
+ nb_chunk_length = gr.Number(label="Chunk Length", value=lambda: None, precision=0,
146
  info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
147
+ nb_hallucination_silence_threshold = gr.Number(label="Hallucination Silence Threshold (sec)",
148
+ value=lambda: None,
149
+ info="When 'Word Timestamps' is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
150
  tb_hotwords = gr.Textbox(label="Hotwords", value=None,
151
  info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
152
  nb_language_detection_threshold = gr.Number(label="Language Detection Threshold",
 
279
  info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
280
  nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=0, precision=0,
281
  info="Prevent repetitions of n-grams with this size (set 0 to disable).")
282
+ tb_prefix = gr.Textbox(label="Prefix", value=lambda: None, # Bug Fix https://github.com/gradio-app/gradio/issues/6728
283
  info="Optional text to provide as a prefix for the first window.")
284
  cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=True,
285
  info="Suppress blank outputs at the beginning of the sampling.")
286
+ tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value="[-1]",
287
  info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
288
  nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=1.0,
289
  info="The initial timestamp cannot be later than this.")
290
  cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=False,
291
  info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
292
  tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value="\"'“¿([{-",
293
+ info="If 'Word Timestamps' is True, merge these punctuation symbols with the next word.")
294
  tb_append_punctuations = gr.Textbox(label="Append Punctuations",
295
  value="\"'.。,,!!??::”)]}、",
296
+ info="If 'Word Timestamps' is True, merge these punctuation symbols with the previous word.")
297
+ nb_max_new_tokens = gr.Number(label="Max New Tokens", value=lambda: None, precision=0,
298
  info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
299
+ nb_chunk_length = gr.Number(label="Chunk Length", value=lambda: None, precision=0,
300
  info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
301
+ nb_hallucination_silence_threshold = gr.Number(
302
+ label="Hallucination Silence Threshold (sec)",
303
+ value=lambda: None,
304
+ info="When 'Word Timestamps' is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
305
  tb_hotwords = gr.Textbox(label="Hotwords", value=None,
306
  info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
307
  nb_language_detection_threshold = gr.Number(label="Language Detection Threshold",
 
426
  info="Penalty applied to the score of previously generated tokens (set > 1 to penalize).")
427
  nb_no_repeat_ngram_size = gr.Number(label="No Repeat N-gram Size", value=0, precision=0,
428
  info="Prevent repetitions of n-grams with this size (set 0 to disable).")
429
+ tb_prefix = gr.Textbox(label="Prefix", value=lambda: None, # Bug Fix https://github.com/gradio-app/gradio/issues/6728
430
  info="Optional text to provide as a prefix for the first window.")
431
  cb_suppress_blank = gr.Checkbox(label="Suppress Blank", value=True,
432
  info="Suppress blank outputs at the beginning of the sampling.")
433
+ tb_suppress_tokens = gr.Textbox(label="Suppress Tokens", value="[-1]",
434
  info="List of token IDs to suppress. -1 will suppress a default set of symbols as defined in the model config.json file.")
435
  nb_max_initial_timestamp = gr.Number(label="Max Initial Timestamp", value=1.0,
436
  info="The initial timestamp cannot be later than this.")
437
  cb_word_timestamps = gr.Checkbox(label="Word Timestamps", value=False,
438
  info="Extract word-level timestamps using the cross-attention pattern and dynamic time warping, and include the timestamps for each word in each segment.")
439
  tb_prepend_punctuations = gr.Textbox(label="Prepend Punctuations", value="\"'“¿([{-",
440
+ info="If 'Word Timestamps' is True, merge these punctuation symbols with the next word.")
441
  tb_append_punctuations = gr.Textbox(label="Append Punctuations",
442
  value="\"'.。,,!!??::”)]}、",
443
+ info="If 'Word Timestamps' is True, merge these punctuation symbols with the previous word.")
444
+ nb_max_new_tokens = gr.Number(label="Max New Tokens", value=lambda: None, precision=0,
445
  info="Maximum number of new tokens to generate per-chunk. If not set, the maximum will be set by the default max_length.")
446
+ nb_chunk_length = gr.Number(label="Chunk Length", value=lambda: None, precision=0,
447
  info="The length of audio segments. If it is not None, it will overwrite the default chunk_length of the FeatureExtractor.")
448
+ nb_hallucination_silence_threshold = gr.Number(
449
+ label="Hallucination Silence Threshold (sec)",
450
+ value=lambda: None,
451
+ info="When 'Word Timestamps' is True, skip silent periods longer than this threshold (in seconds) when a possible hallucination is detected.")
452
  tb_hotwords = gr.Textbox(label="Hotwords", value=None,
453
  info="Hotwords/hint phrases to provide the model with. Has no effect if prefix is not None.")
454
  nb_language_detection_threshold = gr.Number(label="Language Detection Threshold",