marcellopoliti's picture
feat: add pdf docs
c5a0a6e
raw
history blame
1.41 kB
import streamlit as st
from utils import get_chroma_client, get_embedding_function
# streamlit_app.py
import hmac
import streamlit as st
import os
__import__("pysqlite3")
import sys
sys.modules["sqlite3"] = sys.modules.pop("pysqlite3")
st.set_page_config(page_title="Hello", page_icon="πŸ‘‹", layout="wide")
def check_password():
"""Returns `True` if the user had the correct password."""
def password_entered():
"""Checks whether a password entered by the user is correct."""
if hmac.compare_digest(st.session_state["password"], st.secrets["password"]):
st.session_state["password_correct"] = True
del st.session_state["password"] # Don't store the password.
else:
st.session_state["password_correct"] = False
# Return True if the password is validated.
if st.session_state.get("password_correct", False):
return True
# Show input for password.
st.text_input(
"Password", type="password", on_change=password_entered, key="password"
)
if "password_correct" in st.session_state:
st.error("πŸ˜• Password incorrect")
return False
if not check_password():
st.stop() # Do not continue if check_password is not True.
# Main Streamlit app starts here
st.write("# Brian Knowledge Base System! πŸ‘‹")
client = get_chroma_client()
default_embedding_function = get_embedding_function()