Merge pull request #38 from Monadical-SAS/feat/gokul

Return transcription text in the response along with title
This commit is contained in:
projects-g
2023-07-20 21:14:56 +05:30
committed by GitHub

View File

@@ -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,6 +108,7 @@ def channel_send_transcript(channel):
message = sorted_transcripts[least_time]
if message:
del sorted_transcripts[least_time]
if message["text"] not in blacklisted_messages:
channel.send(json.dumps(message))
except Exception as e:
print("Exception", str(e))
@@ -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,