Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,8 @@ import openai
|
|
8 |
prompt = "Type and press Enter"
|
9 |
|
10 |
|
11 |
-
def record_text(audio_file):
|
|
|
12 |
audio_file = open(audio_file, "rb")
|
13 |
transcript = openai.Audio.transcribe("whisper-1", audio_file)
|
14 |
text = transcript['text']
|
@@ -38,7 +39,7 @@ def record_text(audio_file):
|
|
38 |
|
39 |
|
40 |
def api_calling(audio_file, prompt, api_key):
|
41 |
-
audio_text = record_text(audio_file)
|
42 |
if len(prompt) == 0:
|
43 |
prompt = "Apply proper punctuations, upper case and lower case to the provided text."
|
44 |
|
|
|
8 |
prompt = "Type and press Enter"
|
9 |
|
10 |
|
11 |
+
def record_text(audio_file,api_key):
|
12 |
+
openai.api_key = api_key
|
13 |
audio_file = open(audio_file, "rb")
|
14 |
transcript = openai.Audio.transcribe("whisper-1", audio_file)
|
15 |
text = transcript['text']
|
|
|
39 |
|
40 |
|
41 |
def api_calling(audio_file, prompt, api_key):
|
42 |
+
audio_text = record_text(audio_file,api_key)
|
43 |
if len(prompt) == 0:
|
44 |
prompt = "Apply proper punctuations, upper case and lower case to the provided text."
|
45 |
|