Update app.py
Browse files
app.py
CHANGED
@@ -104,20 +104,36 @@ def cleanup_expired_files():
|
|
104 |
with st.sidebar:
|
105 |
st.title("Upload PDF:")
|
106 |
|
107 |
-
research_field = st.text_input(
|
108 |
-
|
|
|
|
|
|
|
109 |
|
110 |
if not research_field:
|
111 |
st.info("Please enter a research field to proceed.")
|
112 |
-
option = st.selectbox('Select Mode', ('Chat', 'Graph and Table', 'Code', 'Custom Prompting'), disabled=True)
|
113 |
uploaded_file = st.file_uploader("", type=["pdf"], disabled=True)
|
114 |
else:
|
115 |
-
option = st.selectbox('Select Mode', ('Chat', 'Graph and Table', 'Code', 'Custom Prompting'))
|
116 |
uploaded_file = st.file_uploader("", type=["pdf"], disabled=False)
|
117 |
|
118 |
-
temperature = st.slider(
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
## Initialize unique ID, db_client, db_path, and timestamp if not already in session state
|
123 |
if 'db_client' not in st.session_state:
|
@@ -153,7 +169,12 @@ if uploaded_file is not None and st.session_state['document_text'] is None:
|
|
153 |
st.session_state['document_text'] = document_text
|
154 |
|
155 |
text_content_chunks = contextChunks(document_text, chunk_size, chunk_overlap)
|
156 |
-
text_contents_embeddings = contextEmbeddingChroma(
|
|
|
|
|
|
|
|
|
|
|
157 |
st.session_state['text_embeddings'] = text_contents_embeddings
|
158 |
|
159 |
if st.session_state['document_text'] and st.session_state['text_embeddings']:
|
|
|
104 |
with st.sidebar:
|
105 |
st.title("Upload PDF:")
|
106 |
|
107 |
+
research_field = st.text_input(
|
108 |
+
"Research Field: ",
|
109 |
+
key="research_field",
|
110 |
+
placeholder="Enter research fields with commas"
|
111 |
+
)
|
112 |
|
113 |
if not research_field:
|
114 |
st.info("Please enter a research field to proceed.")
|
|
|
115 |
uploaded_file = st.file_uploader("", type=["pdf"], disabled=True)
|
116 |
else:
|
|
|
117 |
uploaded_file = st.file_uploader("", type=["pdf"], disabled=False)
|
118 |
|
119 |
+
temperature = st.slider(
|
120 |
+
"Select Temperature",
|
121 |
+
min_value=0.0,
|
122 |
+
max_value=1.0,
|
123 |
+
value=0.05,
|
124 |
+
step=0.01
|
125 |
+
)
|
126 |
+
selected_llm_model = st.selectbox(
|
127 |
+
"Select LLM Model",
|
128 |
+
options=list(llm_model.keys()),
|
129 |
+
index=3
|
130 |
+
)
|
131 |
+
top_k = st.slider(
|
132 |
+
"Select Top K Matches",
|
133 |
+
min_value=1,
|
134 |
+
max_value=20,
|
135 |
+
value=5
|
136 |
+
)
|
137 |
|
138 |
## Initialize unique ID, db_client, db_path, and timestamp if not already in session state
|
139 |
if 'db_client' not in st.session_state:
|
|
|
169 |
st.session_state['document_text'] = document_text
|
170 |
|
171 |
text_content_chunks = contextChunks(document_text, chunk_size, chunk_overlap)
|
172 |
+
text_contents_embeddings = contextEmbeddingChroma(
|
173 |
+
embeddModel,
|
174 |
+
text_content_chunks,
|
175 |
+
db_client,
|
176 |
+
db_path=db_path
|
177 |
+
)
|
178 |
st.session_state['text_embeddings'] = text_contents_embeddings
|
179 |
|
180 |
if st.session_state['document_text'] and st.session_state['text_embeddings']:
|