-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.py
101 lines (64 loc) · 1.38 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import streamlit as st
from streamlit_server_state import server_state
from helper.modelling import (
determine_rerun_reinitialize,
initialize_llm,
load_rag_pipeline,
set_static_model_params,
)
from helper.ui import (
import_chat,
import_styles,
initial_placeholder,
ui_advanced_model_params,
ui_export_chat_end_session,
ui_header,
ui_reset,
ui_model_params,
ui_tab,
ui_upload_docs,
)
from helper.user_management import (
check_password,
determine_availability,
setup_local_files,
)
# parameters/authentication
setup_local_files()
# tab icon and text
ui_tab()
### session initialization/login
determine_availability()
if not check_password():
st.stop()
### initial setup
# header
ui_header()
# styles sheets
import_styles()
# placeholder on initial load
initial_placeholder()
### sidebar
# upload your own documents section
ui_upload_docs()
st.sidebar.divider()
# model parameters
ui_model_params()
# advanced model parameters
ui_advanced_model_params()
st.sidebar.divider()
# reset memory button
ui_reset()
### model
# load the LLM
initialize_llm()
# static model params
set_static_model_params()
# determine if the database needs to be reinitialized
determine_rerun_reinitialize()
# loading model
load_rag_pipeline()
### chat logic
import_chat()
### final UI elements
ui_export_chat_end_session()