Skip to content

Commit

Permalink
tutorial69
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed May 27, 2024
1 parent 23d63af commit 46dabd3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions tutorial69/main.py
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 added tutorial69/tutorial69.pptx
Binary file not shown.

0 comments on commit 46dabd3

Please sign in to comment.