Spaces:
Runtime error
Runtime error
Commit ·
abc2da4
1
Parent(s): 26b4d6a
Removed play()
Browse files- app.py +3 -7
- interface.py +1 -1
app.py
CHANGED
|
@@ -7,21 +7,17 @@ openai.api_key=os.environ["OPENAI_API_KEY"]
|
|
| 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 |
-
|
| 22 |
-
return
|
| 23 |
-
|
| 24 |
-
#outputs = gr.Audio(label="Output")
|
| 25 |
|
| 26 |
demo = gr.Interface(
|
| 27 |
fn=process,
|
|
|
|
| 7 |
|
| 8 |
import gradio as gr
|
| 9 |
from langchain.llms import OpenAI
|
|
|
|
| 10 |
from interface import AudioInterface
|
| 11 |
interface = AudioInterface()
|
| 12 |
|
|
|
|
| 13 |
def process(filepath):
|
| 14 |
print(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,
|
interface.py
CHANGED
|
@@ -24,4 +24,4 @@ class AudioInterface:
|
|
| 24 |
voice='Bella',
|
| 25 |
model='eleven_monolingual_v1'
|
| 26 |
)
|
| 27 |
-
return audio
|
|
|
|
| 24 |
voice='Bella',
|
| 25 |
model='eleven_monolingual_v1'
|
| 26 |
)
|
| 27 |
+
return play(audio)
|