79302190

Date: 2024-12-23 05:09:40
Score: 0.5
Natty:
Report link

Although one might expect the following base-64 encoding and decoding to cancel, the following code appears to work. (The code is a slightly modified version from this page.)

...
    encoded_audio = base64.b64encode(open(audio_path, "rb").read()).decode("utf-8")
    mime_type = "audio/mpeg"
    audio_content = Part.from_data(
        data=base64.b64decode(encoded_audio), mime_type=mime_type
    )

    contents = [audio_content, prompt]
...
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Bill Bradley