Updating app.py File
Browse files
app.py
CHANGED
|
@@ -9,13 +9,7 @@ from langchain_core.runnables import RunnableLambda, RunnablePassthrough
|
|
| 9 |
import os
|
| 10 |
import gradio as gr
|
| 11 |
import whisper
|
| 12 |
-
|
| 13 |
-
# Loading the OPENAI Model
|
| 14 |
from openai import OpenAI
|
| 15 |
-
client = OpenAI()
|
| 16 |
-
|
| 17 |
-
# Loading the Whisper Model
|
| 18 |
-
model_whisper = whisper.load_model("base")
|
| 19 |
|
| 20 |
# *****Deploying the ChatBot using Gradio Application*****
|
| 21 |
|
|
@@ -56,10 +50,13 @@ def conversation_chatbot_function(api_key, audio_path): #question):
|
|
| 56 |
)
|
| 57 |
|
| 58 |
# Speech-to-Text
|
| 59 |
-
|
| 60 |
result = model_whisper.transcribe(audio_path)
|
| 61 |
text_result = qa_chain.invoke(result["text"])
|
| 62 |
|
|
|
|
|
|
|
|
|
|
| 63 |
# Text-to-Speech
|
| 64 |
response = client.audio.speech.create(
|
| 65 |
model="tts-1",
|
|
|
|
| 9 |
import os
|
| 10 |
import gradio as gr
|
| 11 |
import whisper
|
|
|
|
|
|
|
| 12 |
from openai import OpenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# *****Deploying the ChatBot using Gradio Application*****
|
| 15 |
|
|
|
|
| 50 |
)
|
| 51 |
|
| 52 |
# Speech-to-Text
|
| 53 |
+
model_whisper = whisper.load_model("base")
|
| 54 |
result = model_whisper.transcribe(audio_path)
|
| 55 |
text_result = qa_chain.invoke(result["text"])
|
| 56 |
|
| 57 |
+
# Loading the OPENAI Model
|
| 58 |
+
client = OpenAI()
|
| 59 |
+
|
| 60 |
# Text-to-Speech
|
| 61 |
response = client.audio.speech.create(
|
| 62 |
model="tts-1",
|