oceansweep commited on
Commit
267a582
·
verified ·
1 Parent(s): fd559f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -364,16 +364,20 @@ def process_url(input_path, num_speakers=2, whisper_model="small.en", offset=0,
364
  if results:
365
  transcription_result = results[0]
366
  json_file_path = transcription_result['audio_file'].replace('.wav', '.segments.json')
 
367
  with open(json_file_path, 'r') as file:
368
  json_data = json.load(file)
369
-
370
  summary_file_path = json_file_path.replace('.segments.json', '_summary.txt')
 
371
  if os.path.exists(summary_file_path):
372
  return json_data, summary_file_path, json_file_path, summary_file_path
 
373
  else:
374
  return json_data, "Summary not available.", json_file_path, None
 
375
  else:
376
  return None, "No results found.", None, None
 
377
  except Exception as e:
378
  error_message = f"An error occurred: {str(e)}"
379
  return None, error_message, None, None
@@ -1270,7 +1274,8 @@ def launch_ui(demo_mode=False):
1270
  fn=lambda *args: process_url(*args, demo_mode=demo_mode),
1271
  inputs=inputs,
1272
  outputs=[
1273
- gr.components.Textbox(label="Transcription", value=lambda json_data: process_transcription(json_data), max_lines=10),
 
1274
  # gr.components.Textbox(label="Transcription", value=lambda: "", max_lines=10),
1275
  gr.components.Textbox(label="Summary or Status Message"),
1276
  gr.components.File(label="Download Transcription as JSON"),
 
364
  if results:
365
  transcription_result = results[0]
366
  json_file_path = transcription_result['audio_file'].replace('.wav', '.segments.json')
367
+
368
  with open(json_file_path, 'r') as file:
369
  json_data = json.load(file)
 
370
  summary_file_path = json_file_path.replace('.segments.json', '_summary.txt')
371
+
372
  if os.path.exists(summary_file_path):
373
  return json_data, summary_file_path, json_file_path, summary_file_path
374
+
375
  else:
376
  return json_data, "Summary not available.", json_file_path, None
377
+
378
  else:
379
  return None, "No results found.", None, None
380
+
381
  except Exception as e:
382
  error_message = f"An error occurred: {str(e)}"
383
  return None, error_message, None, None
 
1274
  fn=lambda *args: process_url(*args, demo_mode=demo_mode),
1275
  inputs=inputs,
1276
  outputs=[
1277
+ gr.components.Textbox(label="Transcription", value=lambda json_data: process_transcription(json_data) if json_data else "", max_lines=10),
1278
+ # gr.components.Textbox(label="Transcription", value=lambda json_data: process_transcription(json_data), max_lines=10),
1279
  # gr.components.Textbox(label="Transcription", value=lambda: "", max_lines=10),
1280
  gr.components.Textbox(label="Summary or Status Message"),
1281
  gr.components.File(label="Download Transcription as JSON"),