Spaces:
Sleeping
Sleeping
Update helpers.py
Browse files- helpers.py +4 -4
helpers.py
CHANGED
@@ -17,13 +17,13 @@ def get_api_key():
|
|
17 |
return None
|
18 |
|
19 |
def speech_to_text(audio_data):
|
|
|
20 |
with open(audio_data, "rb") as audio_file:
|
21 |
-
transcript = openai.Audio.
|
22 |
-
model="whisper-1",
|
23 |
-
response_format="text",
|
24 |
file=audio_file
|
25 |
)
|
26 |
-
return transcript
|
27 |
|
28 |
|
29 |
def text_to_speech(input_text):
|
|
|
17 |
return None
|
18 |
|
19 |
def speech_to_text(audio_data):
|
20 |
+
"""Transcribes audio data to text using OpenAI's API."""
|
21 |
with open(audio_data, "rb") as audio_file:
|
22 |
+
transcript = openai.Audio.transcribe(
|
23 |
+
model="whisper-1", # Ensure the model is correct
|
|
|
24 |
file=audio_file
|
25 |
)
|
26 |
+
return transcript["text"] # Extract the text from the response
|
27 |
|
28 |
|
29 |
def text_to_speech(input_text):
|