Spaces:
Runtime error
Runtime error
Commit
·
db80382
1
Parent(s):
0227d3f
Updated sequence of play()
Browse files- app.py +5 -1
- interface.py +1 -1
app.py
CHANGED
@@ -7,18 +7,22 @@ openai.api_key=os.environ["OPENAI_API_KEY"]
|
|
7 |
|
8 |
import gradio as gr
|
9 |
from langchain.llms import OpenAI
|
|
|
10 |
from interface import AudioInterface
|
11 |
interface = AudioInterface()
|
12 |
|
13 |
|
14 |
def process(filepath):
|
|
|
15 |
audio = open(filepath,"rb")
|
16 |
transcript = openai.Audio.transcribe("whisper-1",audio)
|
17 |
llm = OpenAI(temperature=1)
|
18 |
print(llm(transcript["text"]))
|
19 |
-
interface.speak(llm(transcript["text"]))
|
20 |
return llm(transcript["text"])
|
21 |
|
|
|
|
|
22 |
demo = gr.Interface(
|
23 |
fn=process,
|
24 |
inputs=gr.Audio(source="microphone",type="filepath"),
|
|
|
7 |
|
8 |
import gradio as gr
|
9 |
from langchain.llms import OpenAI
|
10 |
+
from elevenlabs import play
|
11 |
from interface import AudioInterface
|
12 |
interface = AudioInterface()
|
13 |
|
14 |
|
15 |
def process(filepath):
|
16 |
+
print(filepath)
|
17 |
audio = open(filepath,"rb")
|
18 |
transcript = openai.Audio.transcribe("whisper-1",audio)
|
19 |
llm = OpenAI(temperature=1)
|
20 |
print(llm(transcript["text"]))
|
21 |
+
play(interface.speak(llm(transcript["text"])))
|
22 |
return llm(transcript["text"])
|
23 |
|
24 |
+
#outputs = gr.Audio(label="Output")
|
25 |
+
|
26 |
demo = gr.Interface(
|
27 |
fn=process,
|
28 |
inputs=gr.Audio(source="microphone",type="filepath"),
|
interface.py
CHANGED
@@ -24,4 +24,4 @@ class AudioInterface:
|
|
24 |
voice='Bella',
|
25 |
model='eleven_monolingual_v1'
|
26 |
)
|
27 |
-
|
|
|
24 |
voice='Bella',
|
25 |
model='eleven_monolingual_v1'
|
26 |
)
|
27 |
+
return audio
|