Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,33 +1,33 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
|
| 3 |
-
from st_audiorec import st_audiorec
|
| 4 |
-
|
| 5 |
-
from scripts.services import services
|
| 6 |
-
|
| 7 |
-
from langchain_community.vectorstores import FAISS
|
| 8 |
-
from langchain_huggingface import HuggingFaceEmbeddings
|
| 9 |
-
|
| 10 |
-
from gtts import gTTS
|
| 11 |
-
|
| 12 |
-
vc = FAISS.load_local(
|
| 13 |
-
'vc_iter_1' ,
|
| 14 |
-
embeddings = HuggingFaceEmbeddings(model_name = 'all-MiniLM-L6-v2') ,
|
| 15 |
-
allow_dangerous_deserialization = True
|
| 16 |
-
)
|
| 17 |
-
|
| 18 |
-
wav_audio_data = st_audiorec()
|
| 19 |
-
|
| 20 |
-
if st.button('Ask') :
|
| 21 |
-
|
| 22 |
-
services.save_audio_from_bytes(wav_audio_data)
|
| 23 |
-
text = services.transcript()
|
| 24 |
-
st.write(text)
|
| 25 |
-
|
| 26 |
-
response = services.run_rag(text , vc)
|
| 27 |
-
|
| 28 |
-
st.write(response)
|
| 29 |
-
|
| 30 |
-
tts = gTTS(text = response , lang = '
|
| 31 |
-
tts.save('response.mp3')
|
| 32 |
-
|
| 33 |
st.audio('response.mp3')
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
from st_audiorec import st_audiorec
|
| 4 |
+
|
| 5 |
+
from scripts.services import services
|
| 6 |
+
|
| 7 |
+
from langchain_community.vectorstores import FAISS
|
| 8 |
+
from langchain_huggingface import HuggingFaceEmbeddings
|
| 9 |
+
|
| 10 |
+
from gtts import gTTS
|
| 11 |
+
|
| 12 |
+
vc = FAISS.load_local(
|
| 13 |
+
'vc_iter_1' ,
|
| 14 |
+
embeddings = HuggingFaceEmbeddings(model_name = 'all-MiniLM-L6-v2') ,
|
| 15 |
+
allow_dangerous_deserialization = True
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
wav_audio_data = st_audiorec()
|
| 19 |
+
|
| 20 |
+
if st.button('Ask') :
|
| 21 |
+
|
| 22 |
+
services.save_audio_from_bytes(wav_audio_data)
|
| 23 |
+
text = services.transcript()
|
| 24 |
+
st.write(text)
|
| 25 |
+
|
| 26 |
+
response = services.run_rag(text , vc)
|
| 27 |
+
|
| 28 |
+
st.write(response)
|
| 29 |
+
|
| 30 |
+
tts = gTTS(text = response , lang = 'en')
|
| 31 |
+
tts.save('response.mp3')
|
| 32 |
+
|
| 33 |
st.audio('response.mp3')
|