sergiolucero commited on
Commit
f068297
1 Parent(s): 4c067ae

Update ailib.py

Browse files
Files changed (1) hide show
  1. ailib.py +9 -2
ailib.py CHANGED
@@ -30,11 +30,18 @@ def nueva_ficha(resumen_historial, resumen_hoy):
30
 
31
 
32
  def whisper_transcribe(fn, temperature=0):
 
33
  t0 = time.time()
34
- audio_file = open(fn,'rb') # redundant?
 
 
 
 
 
 
35
  whisper = openai_client.audio.transcriptions.create
36
  transcript = whisper(model=OPENAI_TRANSCRIPTION_MODEL,
37
- file=audio_file, language='es',
38
  temperature=0.0) # to do, explore temperature
39
  dt = round(time.time()-t0,2)
40
 
 
30
 
31
 
32
  def whisper_transcribe(fn, temperature=0):
33
+
34
  t0 = time.time()
35
+
36
+ if isinstance(fn, str):
37
+ audio_file = open(fn,'rb') # redundant?
38
+ else:
39
+ open('temp.wav','wb').write(fn)
40
+ audio_file = 'temp.wav'
41
+
42
  whisper = openai_client.audio.transcriptions.create
43
  transcript = whisper(model=OPENAI_TRANSCRIPTION_MODEL,
44
+ file = audio_file, language='es',
45
  temperature=0.0) # to do, explore temperature
46
  dt = round(time.time()-t0,2)
47