Skip to content

Commit

Permalink
Remove sample rate
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Jan 5, 2024
1 parent 43fb460 commit b0e645f
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 b0e645f

Please sign in to comment.