Nick088 commited on
Commit
abb3da6
·
verified ·
1 Parent(s): d65f95e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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(audio_file, prompt, language):
48
- with open(audio_file.name, "rb") as file:
49
  transcription = client.audio.transcriptions.create(
50
- file=(audio_file.name, file.read()),
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(audio_file, prompt):
61
- with open(audio_file.name, "rb") as file:
62
  translation = client.audio.translations.create(
63
- file=(audio_file.name, file.read()),
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",