-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
from streamlit_mic_recorder import mic_recorder,speech_to_text | ||
from langchain_openai import ChatOpenAI | ||
import streamlit as st | ||
from streamlit_mic_recorder import speech_to_text | ||
|
||
|
||
def record_voice(language="en"): | ||
# https://github.com/B4PT0R/streamlit-mic-recorder?tab=readme-ov-file#example | ||
|
||
state = st.session_state | ||
|
||
if "text_received" not in state: | ||
state.text_received = [] | ||
|
||
text = speech_to_text( | ||
start_prompt="🎤 Click and speak to ask question", | ||
stop_prompt="⚠️Stop recording🚨", | ||
language=language, | ||
use_container_width=False, | ||
just_once=False, | ||
) | ||
llm=ChatOpenAI(model="gpt-4o") | ||
st.title("Your One Stop Voice Assistant") | ||
st.write("Voice enabled Chat App") | ||
|
||
# audio=mic_recorder(start_prompt="**",stop_prompt="##",key="recorder") | ||
# if audio: | ||
# st.audio(audio["bytes"]) | ||
|
||
text=speech_to_text(language="en",use_container_width=True,just_once=True,key="STT") | ||
if text: | ||
response=llm.invoke(text) | ||
st.write(response.content) |
Binary file not shown.