Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,15 @@ import whisper
|
|
4 |
import streamlit as st
|
5 |
from groq import Groq
|
6 |
from TTS.api import TTS
|
|
|
7 |
from tempfile import NamedTemporaryFile
|
8 |
from streamlit_webrtc import webrtc_streamer, WebRtcMode, ClientSettings
|
9 |
import av
|
10 |
|
|
|
|
|
|
|
|
|
11 |
# LLM Response Function
|
12 |
def get_llm_response(api_key, user_input):
|
13 |
client = Groq(api_key=api_key)
|
@@ -149,8 +154,7 @@ def main():
|
|
149 |
return
|
150 |
|
151 |
# Get AI Response
|
152 |
-
|
153 |
-
response_text = get_llm_response(api_key, user_input)
|
154 |
|
155 |
# Generate Speech
|
156 |
output_audio_path = "output_speech.wav"
|
@@ -162,4 +166,4 @@ def main():
|
|
162 |
st.error(str(e))
|
163 |
|
164 |
if __name__ == "__main__":
|
165 |
-
main()
|
|
|
4 |
import streamlit as st
|
5 |
from groq import Groq
|
6 |
from TTS.api import TTS
|
7 |
+
from dotenv import load_dotenv
|
8 |
from tempfile import NamedTemporaryFile
|
9 |
from streamlit_webrtc import webrtc_streamer, WebRtcMode, ClientSettings
|
10 |
import av
|
11 |
|
12 |
+
# Load API key from Hugging Face
|
13 |
+
load_dotenv()
|
14 |
+
API_KEY = os.getenv("HUGGINGFACE_API_KEY")
|
15 |
+
|
16 |
# LLM Response Function
|
17 |
def get_llm_response(api_key, user_input):
|
18 |
client = Groq(api_key=api_key)
|
|
|
154 |
return
|
155 |
|
156 |
# Get AI Response
|
157 |
+
response_text = get_llm_response(API_KEY, user_input)
|
|
|
158 |
|
159 |
# Generate Speech
|
160 |
output_audio_path = "output_speech.wav"
|
|
|
166 |
st.error(str(e))
|
167 |
|
168 |
if __name__ == "__main__":
|
169 |
+
main()
|