son9john commited on
Commit
d6ee0f4
·
1 Parent(s): b08287b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -78,7 +78,7 @@ def transcribe(audio, text):
78
  buffer = []
79
  for sentence in sentences:
80
  sentence_tokens = tokenizer.encode(sentence)
81
- if len(buffer) + len(sentence_tokens) > 800:
82
  subinput_tokens.append(buffer)
83
  buffer = []
84
  buffer.extend(sentence_tokens)
@@ -92,7 +92,7 @@ def transcribe(audio, text):
92
  messages.append({"role": "user", "content": transcript["text"]+subinput_text})
93
 
94
  num_tokens = sum(len(tokenizer.encode(message["content"])) for message in messages)
95
- if num_tokens > 1640:
96
  # Concatenate the chat history
97
  chat_transcript = "\n\n".join([f"[ANSWER {answer_count}]{message['role']}: {message['content']}" for message in messages if message['role'] != 'user'])
98
  # Append the number of tokens used to the end of the chat transcript
 
78
  buffer = []
79
  for sentence in sentences:
80
  sentence_tokens = tokenizer.encode(sentence)
81
+ if len(buffer) + len(sentence_tokens) > 400:
82
  subinput_tokens.append(buffer)
83
  buffer = []
84
  buffer.extend(sentence_tokens)
 
92
  messages.append({"role": "user", "content": transcript["text"]+subinput_text})
93
 
94
  num_tokens = sum(len(tokenizer.encode(message["content"])) for message in messages)
95
+ if num_tokens > 1400:
96
  # Concatenate the chat history
97
  chat_transcript = "\n\n".join([f"[ANSWER {answer_count}]{message['role']}: {message['content']}" for message in messages if message['role'] != 'user'])
98
  # Append the number of tokens used to the end of the chat transcript