Skip to content

Commit

Permalink
Merge pull request #427 from coronasafe/audio-rate
Browse files Browse the repository at this point in the history
Remove sample rate
  • Loading branch information
gigincg authored Jan 5, 2024
2 parents 43fb460 + b0e645f commit d8ef1f8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ayushma/utils/speech_to_text.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import os

import openai
Expand Down Expand Up @@ -43,21 +42,20 @@ def recognize(self, audio):

config = speech.RecognitionConfig(
encoding=speech.RecognitionConfig.AudioEncoding.ENCODING_UNSPECIFIED,
sample_rate_hertz=48000,
language_code=self.language_code,
)

response = client.recognize(config=config, audio=audio_data)
if not response.results:
return ""
return response.results[0].alternatives[0].transcript



class SelfHostedEngine:
def __init__(self, api_key, language_code):
self.language_code = language_code

def recognize(self, audio):

response = requests.post(
settings.SELF_HOSTED_ENDPOINT,
files={"audio": audio},
Expand Down

0 comments on commit d8ef1f8

Please sign in to comment.