litagin commited on
Commit
6071242
·
1 Parent(s): 71637f9

delete speed

Browse files
Files changed (1) hide show
  1. app.py +3 -17
app.py CHANGED
@@ -117,15 +117,6 @@ document.addEventListener('keypress', shortcuts, false);
117
  """
118
 
119
 
120
- def modify_speed(
121
- data: tuple[int, np.ndarray], speed: float = 1.0
122
- ) -> tuple[int, np.ndarray]:
123
- if speed == 1.0:
124
- return data
125
- sr, array = data
126
- return sr, librosa.effects.time_stretch(array, rate=speed)
127
-
128
-
129
  def parse_item(item) -> dict:
130
  global counter
131
 
@@ -185,9 +176,6 @@ with gr.Blocks(head=shortcut_js) as app:
185
  with gr.Row():
186
  with gr.Column():
187
  btn_init = gr.Button("読み込み")
188
- speed_slider = gr.Slider(
189
- minimum=0.5, maximum=5.0, step=0.1, value=1.0, label="再生速度"
190
- )
191
  counter_info = gr.Textbox(label="進捗状況")
192
  with gr.Column(variant="panel"):
193
  key = gr.Textbox(label="Key")
@@ -210,11 +198,10 @@ with gr.Blocks(head=shortcut_js) as app:
210
  global current_item
211
  if current_item is None:
212
  current_item = get_next_parsed_item()
213
- modified_audio = modify_speed(current_item["audio"], speed=data[speed_slider])
214
  counter_str = f"{current_item['counter']}/{NUM_SAMPLES}: {current_item['counter'] / NUM_SAMPLES * 100:.2f}%"
215
  return {
216
  key: current_item["key"],
217
- audio: gr.Audio(modified_audio, autoplay=True),
218
  text: current_item["text"],
219
  label: current_item["label"],
220
  label_id: current_item["label_id"],
@@ -244,13 +231,12 @@ with gr.Blocks(head=shortcut_js) as app:
244
 
245
  btn_init.click(
246
  update_current_item,
247
- inputs={speed_slider},
248
  outputs=[key, audio, text, label, label_id, counter_info],
249
  )
250
 
251
  btn_skip.click(
252
  put_unmodified,
253
- inputs={key, label_id, speed_slider},
254
  outputs=[key, audio, text, label, label_id, counter_info],
255
  )
256
 
@@ -277,7 +263,7 @@ with gr.Blocks(head=shortcut_js) as app:
277
  for _id in range(10):
278
  btn_list[_id].click(
279
  functions_list[_id],
280
- inputs={key, speed_slider},
281
  outputs=[key, audio, text, label, label_id, counter_info],
282
  )
283
 
 
117
  """
118
 
119
 
 
 
 
 
 
 
 
 
 
120
  def parse_item(item) -> dict:
121
  global counter
122
 
 
176
  with gr.Row():
177
  with gr.Column():
178
  btn_init = gr.Button("読み込み")
 
 
 
179
  counter_info = gr.Textbox(label="進捗状況")
180
  with gr.Column(variant="panel"):
181
  key = gr.Textbox(label="Key")
 
198
  global current_item
199
  if current_item is None:
200
  current_item = get_next_parsed_item()
 
201
  counter_str = f"{current_item['counter']}/{NUM_SAMPLES}: {current_item['counter'] / NUM_SAMPLES * 100:.2f}%"
202
  return {
203
  key: current_item["key"],
204
+ audio: gr.Audio(current_item["audio"], autoplay=True),
205
  text: current_item["text"],
206
  label: current_item["label"],
207
  label_id: current_item["label_id"],
 
231
 
232
  btn_init.click(
233
  update_current_item,
 
234
  outputs=[key, audio, text, label, label_id, counter_info],
235
  )
236
 
237
  btn_skip.click(
238
  put_unmodified,
239
+ inputs={key, label_id},
240
  outputs=[key, audio, text, label, label_id, counter_info],
241
  )
242
 
 
263
  for _id in range(10):
264
  btn_list[_id].click(
265
  functions_list[_id],
266
+ inputs={key},
267
  outputs=[key, audio, text, label, label_id, counter_info],
268
  )
269