""" Created on Sun Oct 01 10:49:43 2023 @author: Loges """ import streamlit as st import sentencepiece from interaction import generate_response, audio_response, init_pipeline from initialize import install st.set_page_config(page_title='AI Chaperone - RAG', layout='wide') if 'messages' not in st.session_state: st.session_state.messages=[] pipeline = init_pipeline() st.subheader("AI Chaperone") for message in st.session_state.messages: with st.chat_message(message['role']): st.markdown(message['content']) if prompt:=st.chat_input("Enter your query"): with st.chat_message("user"): st.markdown(prompt) st.session_state.messages.append({ 'role':'user', 'content': prompt}) response=generate_response(prompt, pipeline) with st.chat_message("assistant"): st.markdown(response) audio_tag = audio_response(response) st.markdown(audio_tag, unsafe_allow_html=True) st.session_state.messages.append({ 'role':'assistant', 'content': response})