oceansweep commited on
Commit
41a2227
1 Parent(s): a01c107

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -390,8 +390,6 @@ def process_url(url, num_speakers, whisper_model, custom_prompt, offset, api_nam
390
 
391
  if summary_file_path and os.path.exists(summary_file_path):
392
  return formatted_transcription, summary_text, prettified_json_file_path, summary_file_path, video_file_path, None
393
- #elif api_name.lower() == 'huggingface':
394
- # return formatted_transcription, waiting_summary, prettified_json_file_path, None, video_file_path, None
395
  else:
396
  return formatted_transcription, summary_text, prettified_json_file_path, None, video_file_path, None
397
  else:
@@ -1319,8 +1317,8 @@ def launch_ui(demo_mode=False):
1319
  download_audio_input = gr.Checkbox(
1320
  label="Download Audio(Select to allow for file download of selected Video's Audio)", value=False,
1321
  visible=False)
1322
- detail_level_input = gr.Slider(minimum=0.0, maximum=1.0, value=0.1, step=0.1, interactive=False,
1323
- label="Detail Level (Slide me)", visible=True)
1324
 
1325
  inputs = [num_speakers_input, whisper_model_input, custom_prompt_input, offset_input, api_name_input,
1326
  api_key_input, vad_filter_input, download_video_input, download_audio_input, detail_level_input]
@@ -1347,10 +1345,12 @@ def launch_ui(demo_mode=False):
1347
  outputs = [
1348
  gr.Textbox(label="Transcription (Resulting Transcription from your input URL)"),
1349
  gr.Textbox(label="Summary or Status Message (Current status of Summary or Summary itself)"),
1350
- gr.File(label="Download Transcription as JSON (Download the Transcription as a file)"),
1351
- gr.File(label="Download Summary as Text (Download the Summary as a file)"),
1352
- gr.File(label="Download Video (Download the Video as a file)"),
1353
- gr.File(label="Download Audio (Download the Audio as a file)")
 
 
1354
  ]
1355
 
1356
  gr.Interface(
@@ -1447,6 +1447,7 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
1447
  # Perform summarization based on the specified API
1448
  logging.debug(f"MAIN: Summarization being performed by {api_name} API")
1449
  json_file_path = audio_file.replace('.wav', '.segments.json')
 
1450
  if api_name == "huggingface":
1451
  huggingface_api_key = os.getenv('HF_TOKEN').replace('"', '')
1452
  if huggingface_api_key is None:
 
390
 
391
  if summary_file_path and os.path.exists(summary_file_path):
392
  return formatted_transcription, summary_text, prettified_json_file_path, summary_file_path, video_file_path, None
 
 
393
  else:
394
  return formatted_transcription, summary_text, prettified_json_file_path, None, video_file_path, None
395
  else:
 
1317
  download_audio_input = gr.Checkbox(
1318
  label="Download Audio(Select to allow for file download of selected Video's Audio)", value=False,
1319
  visible=False)
1320
+ detail_level_input = gr.Slider(minimum=0.0, maximum=1.0, value=0.1, step=0.1, interactive=True,
1321
+ label="Detail Level (Slide me)", visible=False)
1322
 
1323
  inputs = [num_speakers_input, whisper_model_input, custom_prompt_input, offset_input, api_name_input,
1324
  api_key_input, vad_filter_input, download_video_input, download_audio_input, detail_level_input]
 
1345
  outputs = [
1346
  gr.Textbox(label="Transcription (Resulting Transcription from your input URL)"),
1347
  gr.Textbox(label="Summary or Status Message (Current status of Summary or Summary itself)"),
1348
+ gr.File(label="Download Transcription as JSON (Download the Transcription as a file)",container=False,visible=True,render=False),
1349
+ gr.File(label="Download Summary as Text (Download the Summary as a file)",container=False,visible=True,render=False),
1350
+ # FIXME
1351
+ # https://www.gradio.app/docs/gradio/file
1352
+ gr.File(label="Download Video (Download the Video as a file)",container=False,visible=False,render=False),
1353
+ gr.File(label="Download Audio (Download the Audio as a file)",container=False,visible=False,render=False)
1354
  ]
1355
 
1356
  gr.Interface(
 
1447
  # Perform summarization based on the specified API
1448
  logging.debug(f"MAIN: Summarization being performed by {api_name} API")
1449
  json_file_path = audio_file.replace('.wav', '.segments.json')
1450
+ prettified_json_file_path = transcription_result['audio_file'].replace('.wav', '.segments_pretty.json')
1451
  if api_name == "huggingface":
1452
  huggingface_api_key = os.getenv('HF_TOKEN').replace('"', '')
1453
  if huggingface_api_key is None: