|
import streamlit as st |
|
from rag_with_palm import RAGPaLMQuery |
|
|
|
rag_palm_query_instance = RAGPaLMQuery() |
|
|
|
st.title(f"**NutriMate\'s Assistant Bot** :robot_face:") |
|
|
|
if "messages" not in st.session_state: |
|
st.session_state.messages = [] |
|
|
|
for message in st.session_state.messages: |
|
with st.chat_message(message["role"]): |
|
st.markdown(message["content"]) |
|
|
|
if prompt := st.chat_input("Need info? Drop your question here!"): |
|
|
|
st.chat_message("user").markdown(prompt) |
|
|
|
st.session_state.messages.append({"role": "user", "content": prompt}) |
|
response = rag_palm_query_instance.query_response(prompt) |
|
|
|
with st.chat_message("assistant"): |
|
st.markdown(response) |
|
|
|
st.session_state.messages.append({"role": "assistant", "content": response}) |
|
|
|
|