Update app.py
Browse files
app.py
CHANGED
@@ -283,7 +283,38 @@ def demo():
|
|
283 |
"""PDF-based chatbot (by Dr. Aloke Upadhaya)</center></h2>
|
284 |
<h3>Ask any questions about your PDF documents, along with follow-ups</h3>
|
285 |
""")
|
286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
with gr.Tab("Step 3 - Conversation with chatbot"):
|
288 |
chatbot = gr.Chatbot(height=300)
|
289 |
with gr.Accordion("Advanced - Document references", open=False):
|
|
|
283 |
"""PDF-based chatbot (by Dr. Aloke Upadhaya)</center></h2>
|
284 |
<h3>Ask any questions about your PDF documents, along with follow-ups</h3>
|
285 |
""")
|
286 |
+
with gr.Tab("Step 1 - Document pre-processing"):
|
287 |
+
with gr.Row():
|
288 |
+
document = gr.Files(height=100, file_count="multiple", file_types=["pdf"], interactive=True, label="Upload your PDF documents (single or multiple)")
|
289 |
+
# upload_btn = gr.UploadButton("Loading document...", height=100, file_count="multiple", file_types=["pdf"], scale=1)
|
290 |
+
with gr.Row():
|
291 |
+
db_btn = gr.Radio(["ChromaDB"], label="Vector database type", value = "ChromaDB", type="index", info="Choose your vector database")
|
292 |
+
with gr.Accordion("Advanced options - Document text splitter", open=False):
|
293 |
+
with gr.Row():
|
294 |
+
slider_chunk_size = gr.Slider(minimum = 100, maximum = 1000, value=600, step=20, label="Chunk size", info="Chunk size", interactive=True)
|
295 |
+
with gr.Row():
|
296 |
+
slider_chunk_overlap = gr.Slider(minimum = 10, maximum = 200, value=40, step=10, label="Chunk overlap", info="Chunk overlap", interactive=True)
|
297 |
+
with gr.Row():
|
298 |
+
db_progress = gr.Textbox(label="Vector database initialization", value="None")
|
299 |
+
with gr.Row():
|
300 |
+
db_btn = gr.Button("Generate vector database...")
|
301 |
+
|
302 |
+
with gr.Tab("Step 2 - QA chain initialization"):
|
303 |
+
with gr.Row():
|
304 |
+
llm_btn = gr.Radio(list_llm_simple, \
|
305 |
+
label="LLM models", value = list_llm_simple[0], type="index", info="Choose your LLM model")
|
306 |
+
with gr.Accordion("Advanced options - LLM model", open=False):
|
307 |
+
with gr.Row():
|
308 |
+
slider_temperature = gr.Slider(minimum = 0.0, maximum = 1.0, value=0.7, step=0.1, label="Temperature", info="Model temperature", interactive=True)
|
309 |
+
with gr.Row():
|
310 |
+
slider_maxtokens = gr.Slider(minimum = 224, maximum = 4096, value=1024, step=32, label="Max Tokens", info="Model max tokens", interactive=True)
|
311 |
+
with gr.Row():
|
312 |
+
slider_topk = gr.Slider(minimum = 1, maximum = 10, value=3, step=1, label="top-k samples", info="Model top-k samples", interactive=True)
|
313 |
+
with gr.Row():
|
314 |
+
llm_progress = gr.Textbox(value="None",label="QA chain initialization")
|
315 |
+
with gr.Row():
|
316 |
+
qachain_btn = gr.Button("Initialize question-answering chain...")
|
317 |
+
|
318 |
with gr.Tab("Step 3 - Conversation with chatbot"):
|
319 |
chatbot = gr.Chatbot(height=300)
|
320 |
with gr.Accordion("Advanced - Document references", open=False):
|