cstr commited on
Commit
dbb0e1e
·
verified ·
1 Parent(s): a3dba94

simpler yield

Browse files
Files changed (1) hide show
  1. app.py +2 -23
app.py CHANGED
@@ -349,29 +349,8 @@ with gr.Blocks() as iface:
349
  pipeline_type.change(update_model_dropdown, inputs=pipeline_type, outputs=model_id)
350
 
351
  def transcribe_with_progress(*args):
352
- args = list(args)
353
- verbose_index = 8 # Assuming verbose is the 9th argument (index 8)
354
- args[verbose_index] = True # Force verbose to True
355
-
356
- log_output = ""
357
- def log_callback(message):
358
- nonlocal log_output
359
- log_output += message
360
- yield log_output, "", None
361
-
362
- logger = logging.getLogger()
363
- logger.setLevel(logging.INFO)
364
- log_capture = LogCapture(log_callback)
365
- logger.addHandler(logging.StreamHandler(log_capture))
366
-
367
- try:
368
- for progress in transcribe_audio(*args):
369
- yield log_output + progress, "", None
370
- finally:
371
- logger.removeHandler(log_capture)
372
-
373
- final_transcription = "This is the final transcription." # Replace with actual transcription
374
- yield log_output, final_transcription, None # You might want to yield the actual file here instead of None
375
 
376
  transcribe_button.click(
377
  transcribe_with_progress,
 
349
  pipeline_type.change(update_model_dropdown, inputs=pipeline_type, outputs=model_id)
350
 
351
  def transcribe_with_progress(*args):
352
+ for result in transcribe_audio(*args):
353
+ yield result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
355
  transcribe_button.click(
356
  transcribe_with_progress,