oceansweep commited on
Commit
e2ef143
·
verified ·
1 Parent(s): 81ca0cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1280,8 +1280,8 @@ def launch_ui(demo_mode=False):
1280
  ])
1281
 
1282
  iface = gr.Interface(
1283
- fn=lambda url, num_speakers, whisper_model, offset, api_name, api_key: process_url(url, num_speakers, whisper_model, offset, api_name=api_name, api_key=api_key, demo_mode=demo_mode),
1284
- # fn=lambda *args: process_url(*args, demo_mode=demo_mode),
1285
  inputs=inputs,
1286
  outputs=[
1287
  gr.components.Textbox(label="Transcription", value=lambda: "", max_lines=10),
@@ -1376,29 +1376,29 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
1376
  logging.debug(f"MAIN: Summarization being performed by {api_name}")
1377
  json_file_path = audio_file.replace('.wav', '.segments.json')
1378
  if api_name.lower() == 'openai':
1379
- api_key = openai_api_key
1380
  try:
 
1381
  logging.debug(f"MAIN: trying to summarize with openAI")
1382
  summary = summarize_with_openai(api_key, json_file_path, openai_model)
1383
  except requests.exceptions.ConnectionError:
1384
  r.status_code = "Connection: "
1385
  elif api_name.lower() == 'anthropic':
1386
- api_key = anthropic_api_key
1387
  try:
 
1388
  logging.debug(f"MAIN: Trying to summarize with anthropic")
1389
  summary = summarize_with_claude(api_key, json_file_path, anthropic_model)
1390
  except requests.exceptions.ConnectionError:
1391
  r.status_code = "Connection: "
1392
  elif api_name.lower() == 'cohere':
1393
- api_key = cohere_api_key
1394
  try:
 
1395
  logging.debug(f"MAIN: Trying to summarize with cohere")
1396
  summary = summarize_with_cohere(api_key, json_file_path, cohere_model)
1397
  except requests.exceptions.ConnectionError:
1398
  r.status_code = "Connection: "
1399
  elif api_name.lower() == 'groq':
1400
- api_key = groq_api_key
1401
  try:
 
1402
  logging.debug(f"MAIN: Trying to summarize with Groq")
1403
  summary = summarize_with_groq(api_key, json_file_path, groq_model)
1404
  except requests.exceptions.ConnectionError:
 
1280
  ])
1281
 
1282
  iface = gr.Interface(
1283
+ # fn=lambda url, num_speakers, whisper_model, offset, api_name, api_key: process_url(url, num_speakers, whisper_model, offset, api_name=api_name, api_key=api_key, demo_mode=demo_mode),
1284
+ fn=lambda *args: process_url(*args, demo_mode=demo_mode),
1285
  inputs=inputs,
1286
  outputs=[
1287
  gr.components.Textbox(label="Transcription", value=lambda: "", max_lines=10),
 
1376
  logging.debug(f"MAIN: Summarization being performed by {api_name}")
1377
  json_file_path = audio_file.replace('.wav', '.segments.json')
1378
  if api_name.lower() == 'openai':
 
1379
  try:
1380
+ api_key = openai_api_key
1381
  logging.debug(f"MAIN: trying to summarize with openAI")
1382
  summary = summarize_with_openai(api_key, json_file_path, openai_model)
1383
  except requests.exceptions.ConnectionError:
1384
  r.status_code = "Connection: "
1385
  elif api_name.lower() == 'anthropic':
 
1386
  try:
1387
+ api_key = anthropic_api_key
1388
  logging.debug(f"MAIN: Trying to summarize with anthropic")
1389
  summary = summarize_with_claude(api_key, json_file_path, anthropic_model)
1390
  except requests.exceptions.ConnectionError:
1391
  r.status_code = "Connection: "
1392
  elif api_name.lower() == 'cohere':
 
1393
  try:
1394
+ api_key = cohere_api_key
1395
  logging.debug(f"MAIN: Trying to summarize with cohere")
1396
  summary = summarize_with_cohere(api_key, json_file_path, cohere_model)
1397
  except requests.exceptions.ConnectionError:
1398
  r.status_code = "Connection: "
1399
  elif api_name.lower() == 'groq':
 
1400
  try:
1401
+ api_key = groq_api_key
1402
  logging.debug(f"MAIN: Trying to summarize with Groq")
1403
  summary = summarize_with_groq(api_key, json_file_path, groq_model)
1404
  except requests.exceptions.ConnectionError: