Skip to content

Instantly share code, notes, and snippets.

@hamishdickson
Last active February 7, 2024 07:14
Show Gist options
  • Save hamishdickson/6e7a31a72d9e50106ad10e7a1f8c80f4 to your computer and use it in GitHub Desktop.
Save hamishdickson/6e7a31a72d9e50106ad10e7a1f8c80f4 to your computer and use it in GitHub Desktop.
Rossa H1
The single most important thing that me and Christshon want you to know, is that even if there are still some things you don’t like or don't relate to… he’ll always be your boy, the kid you raised, the kid you love. You made him who he is today… (beat) and he loves you so much for that.
Spider H1
The single most important thing that me and Oscar want you to know, is that even if there are some things you don’t relate to… they’re still your beautiful grandchild, the kid you’ve always loved. And they love you so, so much and are forever grateful for the role you’ve played in their life.
China H1
The most important thing China wants you to know is that even if modeling isn't the path you'd imagined for her, she’s happy and fulfilled, and she's forever grateful for everything you've taught her in life and the role you've played in making her who she is today.
ちながママに知ってもらいたい最も大事ことは、たとえモデルの仕事が想像していた道ではなかったとしても、ちなは幸せで充実しています。ママがこれまでの人生でちなに教えてくれたこと、そしてママがいまのちなに成長するためにしてくれたことすべてに対して感謝しているしこれからもずっとその気持ちはかわりません。
“Never use Chirstshon or any other spelling, always use Krishwan even if text provided in examples has other spellings.”
sentences = re.split(r'((?<=[.!?。]) +|、+)', sentence_buffer)
def speach_to_text(file_path, max_retries=3, timeout=1.5):
attempt = 0
while attempt < max_retries:
start = time.time()
try:
with open(file_path, "rb") as audio_file:
response = st.session_state.openai_client.audio.transcriptions.create(model=CONFIG.stt_model, file=audio_file).text
elapsed_time = time.time() - start
print(f"Attempt {attempt+1}: Time to transcribe: {elapsed_time}")
if elapsed_time <= timeout:
return response
else:
print(f"Attempt {attempt+1} took longer than {timeout} seconds. Retrying...")
except Exception as e:
print(f"An error occurred: {e}")
finally:
attempt += 1
if attempt == max_retries:
print("Maximum retries reached. Operation failed.")
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment