diff --git a/server_executor_cleaned.py b/server_executor_cleaned.py index 1b066eff..e818db9f 100644 --- a/server_executor_cleaned.py +++ b/server_executor_cleaned.py @@ -38,7 +38,8 @@ incremental_responses = [] sorted_transcripts = SortedDict() blacklisted_messages = [" Thank you.", " See you next time!", - " Thank you for watching!", " Bye!"] + " Thank you for watching!", " Bye!", + " And that's what I'm talking about."] def get_title_and_summary(llm_input_text, last_timestamp): @@ -71,6 +72,7 @@ def get_title_and_summary(llm_input_text, last_timestamp): response = requests.post(LLM_URL, headers=headers, json=data) output = json.loads(response.json()["results"][0]["text"]) output["description"] = output.pop("summary") + output["transcript"] = llm_input_text output["timestamp"] =\ str(datetime.timedelta(seconds=round(last_timestamp))) incremental_responses.append(output) @@ -106,7 +108,8 @@ def channel_send_transcript(channel): message = sorted_transcripts[least_time] if message: del sorted_transcripts[least_time] - channel.send(json.dumps(message)) + if message["text"] not in blacklisted_messages: + channel.send(json.dumps(message)) except Exception as e: print("Exception", str(e)) pass @@ -188,7 +191,7 @@ class AudioStreamTrack(MediaStreamTrack): else None ) - if len(transcription_text) > 1500: + if len(transcription_text) > 500: llm_input_text = transcription_text transcription_text = "" llm_result = run_in_executor(get_title_and_summary,