Spaces:
Runtime error
Runtime error
sergiolucero
commited on
Commit
•
e7aceea
1
Parent(s):
246edcb
Create ailib.py
Browse files
ailib.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
|
3 |
+
def whisper_transcribe(fn, temperature=0):
|
4 |
+
t0 = time.time()
|
5 |
+
audio_file = open(fn,'rb') # redundant?
|
6 |
+
whisper = openai_client.audio.transcriptions.create
|
7 |
+
transcript = whisper(model=OPENAI_TRANSCRIPTION_MODEL,
|
8 |
+
file=audio_file, language='es',
|
9 |
+
temperature=temperature) # to do, explore temperature
|
10 |
+
dt = round(time.time()-t0,2)
|
11 |
+
|
12 |
+
transcript = transcript.text
|
13 |
+
print(f'Whisper transcribe [dt={dt} secs]')
|
14 |
+
return transcript
|