File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
generative_ai/understand_audio Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ pandas==2.0.3; python_version == '3.8'
33pandas == 2.1.4 ; python_version > '3.8'
44pillow == 10.3.0 ; python_version < '3.8'
55pillow == 10.3.0 ; python_version >= '3.8'
6- google-cloud-aiplatform [all ]== 1.69.0
6+ google-cloud-aiplatform [all ]== 1.71.1
77sentencepiece == 0.2.0
88google-auth == 2.29.0
99anthropic [vertex ]== 0.28.0
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def transcript_audio() -> str:
2121 # [START generativeaionvertexai_gemini_audio_transcription]
2222
2323 import vertexai
24- from vertexai .generative_models import GenerativeModel , Part
24+ from vertexai .generative_models import GenerativeModel , GenerationConfig , Part
2525
2626 # TODO(developer): Update and un-comment below line
2727 # PROJECT_ID = "your-project-id"
@@ -40,14 +40,14 @@ def transcript_audio() -> str:
4040
4141 contents = [audio_file , prompt ]
4242
43- response = model .generate_content (contents )
43+ response = model .generate_content (contents , generation_config = GenerationConfig ( audio_timestamp = True ) )
4444
4545 print (response .text )
4646 # Example response:
47- # [00:00:00] Speaker A: your devices are getting better over time...
47+ # [00:00:00] Speaker A: Your devices are getting better over time...
4848 # [00:00:16] Speaker B: Welcome to the Made by Google podcast, ...
4949 # [00:01:00] Speaker A: So many features. I am a singer. ...
50- # [00:01:33] Speaker B: Amazing. DeCarlos, same question to you. ...
50+ # [00:01:33] Speaker B: Amazing. DeCarlos, same question to you, ...
5151
5252 # [END generativeaionvertexai_gemini_audio_transcription]
5353 return response .text
You can’t perform that action at this time.
0 commit comments