Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,14 +4,17 @@ import gradio as gr
|
|
4 |
from os import path
|
5 |
import requests
|
6 |
import openai
|
|
|
|
|
|
|
7 |
|
8 |
prompt = "Type and press Enter"
|
9 |
|
10 |
|
11 |
def record_text(audio_file,api_key):
|
12 |
-
|
13 |
audio_file = open(audio_file, "rb")
|
14 |
-
transcript =
|
15 |
text = transcript['text']
|
16 |
return text
|
17 |
|
|
|
4 |
from os import path
|
5 |
import requests
|
6 |
import openai
|
7 |
+
from openai import OpenAI
|
8 |
+
|
9 |
+
client = OpenAI(api_key = "<API_KEY>")
|
10 |
|
11 |
prompt = "Type and press Enter"
|
12 |
|
13 |
|
14 |
def record_text(audio_file,api_key):
|
15 |
+
client = OpenAI(api_key = "api_key")
|
16 |
audio_file = open(audio_file, "rb")
|
17 |
+
transcript = client.Audio.transcribe("whisper-1", audio_file)
|
18 |
text = transcript['text']
|
19 |
return text
|
20 |
|