Use of ogg format
This commit is contained in:
parent
f4e7b55e97
commit
b94be5a668
6
main.py
6
main.py
|
@ -35,7 +35,7 @@ def calculate_api_g(response: Response):
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = "/home/mario/.config/gcloud/application_default_credentials.json"
|
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = "token.json"
|
||||||
|
|
||||||
def transcribe_ogg_audio(audio_file_path, language_code='es-US'):
|
def transcribe_ogg_audio(audio_file_path, language_code='es-US'):
|
||||||
client = speech_v1.SpeechClient()
|
client = speech_v1.SpeechClient()
|
||||||
|
@ -45,8 +45,8 @@ def transcribe_ogg_audio(audio_file_path, language_code='es-US'):
|
||||||
|
|
||||||
audio = speech_v1.RecognitionAudio(content=content)
|
audio = speech_v1.RecognitionAudio(content=content)
|
||||||
config = speech_v1.RecognitionConfig(
|
config = speech_v1.RecognitionConfig(
|
||||||
encoding=types.RecognitionConfig.AudioEncoding.FLAC, # Use OGG encoding
|
encoding=types.RecognitionConfig.AudioEncoding.OGG_OPUS,#.FLAC, # Use OGG encoding
|
||||||
sample_rate_hertz=44100, # Update this to match your audio file
|
sample_rate_hertz=48000, # Update this to match your audio file
|
||||||
language_code=language_code,
|
language_code=language_code,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue