Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,10 +44,10 @@ def generate_response(prompt, history, model, temperature, max_tokens, top_p, se
|
|
| 44 |
return response
|
| 45 |
|
| 46 |
|
| 47 |
-
def transcribe_audio(
|
| 48 |
-
with open(
|
| 49 |
transcription = client.audio.transcriptions.create(
|
| 50 |
-
file=(
|
| 51 |
model="whisper-large-v3",
|
| 52 |
prompt=prompt,
|
| 53 |
response_format="json",
|
|
@@ -57,10 +57,10 @@ def transcribe_audio(audio_file, prompt, language):
|
|
| 57 |
return transcription.text
|
| 58 |
|
| 59 |
|
| 60 |
-
def translate_audio(
|
| 61 |
-
with open(
|
| 62 |
translation = client.audio.translations.create(
|
| 63 |
-
file=(
|
| 64 |
model="whisper-large-v3",
|
| 65 |
prompt=prompt,
|
| 66 |
response_format="json",
|
|
|
|
| 44 |
return response
|
| 45 |
|
| 46 |
|
| 47 |
+
def transcribe_audio(audio_file_path, prompt, language):
|
| 48 |
+
with open(audio_file_path, "rb") as file:
|
| 49 |
transcription = client.audio.transcriptions.create(
|
| 50 |
+
file=(os.path.basename(audio_file_path), file.read()),
|
| 51 |
model="whisper-large-v3",
|
| 52 |
prompt=prompt,
|
| 53 |
response_format="json",
|
|
|
|
| 57 |
return transcription.text
|
| 58 |
|
| 59 |
|
| 60 |
+
def translate_audio(audio_file_path, prompt):
|
| 61 |
+
with open(audio_file_path, "rb") as file:
|
| 62 |
translation = client.audio.translations.create(
|
| 63 |
+
file=(os.path.basename(audio_file_path), file.read()),
|
| 64 |
model="whisper-large-v3",
|
| 65 |
prompt=prompt,
|
| 66 |
response_format="json",
|