Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1377,60 +1377,71 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
|
|
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"
|
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"
|
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"
|
1403 |
summary = summarize_with_groq(api_key, json_file_path, groq_model)
|
1404 |
except requests.exceptions.ConnectionError:
|
1405 |
r.status_code = "Connection: "
|
1406 |
elif api_name.lower() == 'llama':
|
1407 |
-
token = llama_api_key
|
1408 |
-
llama_ip = llama_api_IP
|
1409 |
try:
|
1410 |
-
logging.debug(
|
|
|
|
|
|
|
|
|
1411 |
summary = summarize_with_llama(llama_ip, json_file_path, token)
|
1412 |
except requests.exceptions.ConnectionError:
|
1413 |
r.status_code = "Connection: "
|
1414 |
elif api_name.lower() == 'kobold':
|
1415 |
-
token = kobold_api_key
|
1416 |
-
kobold_ip = kobold_api_IP
|
1417 |
try:
|
1418 |
-
logging.debug(
|
|
|
|
|
|
|
|
|
1419 |
summary = summarize_with_kobold(kobold_ip, json_file_path)
|
1420 |
except requests.exceptions.ConnectionError:
|
1421 |
r.status_code = "Connection: "
|
1422 |
elif api_name.lower() == 'ooba':
|
1423 |
-
token = ooba_api_key
|
1424 |
-
ooba_ip = ooba_api_IP
|
1425 |
try:
|
1426 |
-
logging.debug(
|
|
|
|
|
|
|
|
|
1427 |
summary = summarize_with_oobabooga(ooba_ip, json_file_path)
|
1428 |
except requests.exceptions.ConnectionError:
|
1429 |
r.status_code = "Connection: "
|
1430 |
if api_name.lower() == 'huggingface':
|
1431 |
try:
|
|
|
1432 |
api_key = huggingface_api_key
|
1433 |
-
logging.debug(f"
|
1434 |
summarize_with_huggingface(api_key, json_file_path)
|
1435 |
except requests.exceptions.ConnectionError:
|
1436 |
r.status_code = "Connection: "
|
|
|
1377 |
json_file_path = audio_file.replace('.wav', '.segments.json')
|
1378 |
if api_name.lower() == 'openai':
|
1379 |
try:
|
|
|
1380 |
logging.debug(f"MAIN: trying to summarize with openAI")
|
1381 |
+
api_key = openai_api_key
|
1382 |
+
logging.debug(f"OpenAI: OpenAI API Key: {api_key}")
|
1383 |
summary = summarize_with_openai(api_key, json_file_path, openai_model)
|
1384 |
except requests.exceptions.ConnectionError:
|
1385 |
r.status_code = "Connection: "
|
1386 |
elif api_name.lower() == 'anthropic':
|
1387 |
try:
|
1388 |
+
logging.debug("MAIN: Trying to summarize with anthropic")
|
1389 |
api_key = anthropic_api_key
|
1390 |
+
logging.debug(f"Anthropic: Anthropic API Key: {api_key}")
|
1391 |
summary = summarize_with_claude(api_key, json_file_path, anthropic_model)
|
1392 |
except requests.exceptions.ConnectionError:
|
1393 |
r.status_code = "Connection: "
|
1394 |
elif api_name.lower() == 'cohere':
|
1395 |
try:
|
1396 |
+
logging.debug("Main: Trying to summarize with cohere")
|
1397 |
api_key = cohere_api_key
|
1398 |
+
logging.debug(f"Cohere: Cohere API Key: {api_key}")
|
1399 |
summary = summarize_with_cohere(api_key, json_file_path, cohere_model)
|
1400 |
except requests.exceptions.ConnectionError:
|
1401 |
r.status_code = "Connection: "
|
1402 |
elif api_name.lower() == 'groq':
|
1403 |
try:
|
1404 |
+
logging.debug("Main: Trying to summarize with Groq")
|
1405 |
api_key = groq_api_key
|
1406 |
+
logging.debug(f"Groq: Groq API Key: {api_key}")
|
1407 |
summary = summarize_with_groq(api_key, json_file_path, groq_model)
|
1408 |
except requests.exceptions.ConnectionError:
|
1409 |
r.status_code = "Connection: "
|
1410 |
elif api_name.lower() == 'llama':
|
|
|
|
|
1411 |
try:
|
1412 |
+
logging.debug("Main: Trying to summarize with Llama.cpp")
|
1413 |
+
token = llama_api_key
|
1414 |
+
logging.debug(f"Llama.cpp: Llama.cpp API Key: {api_key}")
|
1415 |
+
llama_ip = llama_api_IP
|
1416 |
+
logging.debug(f"Llama.cpp: Llama.cpp API IP:Port : {llama_ip}")
|
1417 |
summary = summarize_with_llama(llama_ip, json_file_path, token)
|
1418 |
except requests.exceptions.ConnectionError:
|
1419 |
r.status_code = "Connection: "
|
1420 |
elif api_name.lower() == 'kobold':
|
|
|
|
|
1421 |
try:
|
1422 |
+
logging.debug("Main: Trying to summarize with kobold.cpp")
|
1423 |
+
token = kobold_api_key
|
1424 |
+
logging.debug(f"kobold.cpp: Kobold.cpp API Key: {api_key}")
|
1425 |
+
kobold_ip = kobold_api_IP
|
1426 |
+
logging.debug(f"kobold.cpp: Kobold.cpp API IP:Port : {kobold_api_IP}")
|
1427 |
summary = summarize_with_kobold(kobold_ip, json_file_path)
|
1428 |
except requests.exceptions.ConnectionError:
|
1429 |
r.status_code = "Connection: "
|
1430 |
elif api_name.lower() == 'ooba':
|
|
|
|
|
1431 |
try:
|
1432 |
+
logging.debug("Main: Trying to summarize with oobabooga")
|
1433 |
+
token = ooba_api_key
|
1434 |
+
logging.debug(f"oobabooga: ooba API Key: {api_key}")
|
1435 |
+
ooba_ip = ooba_api_IP
|
1436 |
+
logging.debug(f"oobabooga: ooba API IP:Port : {ooba_ip}")
|
1437 |
summary = summarize_with_oobabooga(ooba_ip, json_file_path)
|
1438 |
except requests.exceptions.ConnectionError:
|
1439 |
r.status_code = "Connection: "
|
1440 |
if api_name.lower() == 'huggingface':
|
1441 |
try:
|
1442 |
+
logging.debug("MAIN: Trying to summarize with huggingface")
|
1443 |
api_key = huggingface_api_key
|
1444 |
+
logging.debug(f"huggingface: huggingface API Key: {api_key}")
|
1445 |
summarize_with_huggingface(api_key, json_file_path)
|
1446 |
except requests.exceptions.ConnectionError:
|
1447 |
r.status_code = "Connection: "
|