prasanth345 commited on
Commit
699fe54
·
verified ·
1 Parent(s): 7bda0ef

Create voice_ai.py

Browse files
Files changed (1) hide show
  1. voice_ai.py +16 -0
voice_ai.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import openai
3
+
4
+ openai.api_key = "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"
5
+
6
+ def voice_ai(prompt):
7
+ response = openai.Audio.transcribe("whisper-1", prompt)
8
+ return response['text']
9
+
10
+ iface = gr.Interface(
11
+ voice_ai,
12
+ gr.Audio(),
13
+ gr.Textbox(label="Voice AI Response")
14
+ )
15
+
16
+ iface.launch()