Pushing up an attempted fix for breadmixer not being able to submit transcriptions to the database

This commit is contained in:
Bradley Bickford 2024-01-06 15:35:12 -05:00
parent 46fdebd503
commit 44982fd439

View File

@ -62,6 +62,8 @@ cursor.execute("SELECT call_start_time FROM call_states WHERE call_id = %s", [ar
call_start_time = cursor.fetchall() call_start_time = cursor.fetchall()
cursor.close()
if len(call_start_time) == 0: if len(call_start_time) == 0:
print('{call_id} does not exist in the database'.format(call_id=args.callid)) print('{call_id} does not exist in the database'.format(call_id=args.callid))
@ -188,9 +190,11 @@ transcribe = Transcription("openai/whisper-base")
for (k, v) in file_dict.items(): for (k, v) in file_dict.items():
text = transcribe(k) text = transcribe(k)
cursor = mydb.cursor()
cursor.execute("INSERT INTO call_transcriptions (call_id, user_snowflake, speaking_start_time, text) VALUES (%s, %s, %s, %s)", [ cursor.execute("INSERT INTO call_transcriptions (call_id, user_snowflake, speaking_start_time, text) VALUES (%s, %s, %s, %s)", [
args.callid, args.callid,
v["user"], v["user"],
v["real_date"], v["real_date"],
text text
]) ])
cursor.close()