Rabbitt-AI commited on
Commit
3db4344
·
verified ·
1 Parent(s): cbc6d5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -403,7 +403,7 @@ def create_vector_db_and_annoy_index(pdf_path, vector_db_path, annoy_index_path)
403
  print("Vector database and Annoy index creation completed.")
404
 
405
 
406
- def chatbot_interface(file, user_query, response_style, selected_retrieval_methods, selected_reranking_methods, chunk_size, overlap):
407
  vector_db_path = "vector_db.pkl"
408
  annoy_index_path = "vector_index.ann"
409
 
@@ -411,8 +411,8 @@ def chatbot_interface(file, user_query, response_style, selected_retrieval_metho
411
 
412
  chatbot = MistralRAGChatbot(vector_db_path, annoy_index_path)
413
 
414
- selected_retrieval_methods_list = [method.strip() for method in selected_retrieval_methods if method.strip()]
415
- selected_reranking_methods_list = [method.strip() for method in selected_reranking_methods.split(',') if method.strip()]
416
 
417
  response, retrieved_docs, source_info = asyncio.run(chatbot.generate_response_with_rag(
418
  user_query=user_query,
@@ -440,11 +440,9 @@ iface = gr.Interface(
440
  inputs=[
441
  gr.File(label="Upload a PDF"),
442
  gr.Textbox(lines=5, label="User Query"),
443
- gr.Dropdown(["Detailed", "Concise", "Creative", "Technical"], label="Response Style"),
444
- gr.Dropdown(["annoy", "tfidf", "bm25", "euclidean", "jaccard"], label="Retrieval Methods", multiselect=True),
445
- gr.Dropdown(["advanced_fusion", "reciprocal_rank_fusion", "weighted_score_fusion", "semantic_similarity"], label="Reranking Methods"),
446
- gr.Slider(minimum=1024, maximum=2048, step=128, value=2048, label="Chunk Size"),
447
- gr.Slider(minimum=100, maximum=300, step=100, value=200, label="Overlap")
448
  ],
449
  outputs=gr.Textbox(label="RAG Response"),
450
  title="Chance RAG"
 
403
  print("Vector database and Annoy index creation completed.")
404
 
405
 
406
+ def chatbot_interface(file, user_query, response_style):
407
  vector_db_path = "vector_db.pkl"
408
  annoy_index_path = "vector_index.ann"
409
 
 
411
 
412
  chatbot = MistralRAGChatbot(vector_db_path, annoy_index_path)
413
 
414
+ selected_retrieval_methods_list = ['annoy', 'bm25']
415
+ selected_reranking_methods_list = ["advanced_fusion"]
416
 
417
  response, retrieved_docs, source_info = asyncio.run(chatbot.generate_response_with_rag(
418
  user_query=user_query,
 
440
  inputs=[
441
  gr.File(label="Upload a PDF"),
442
  gr.Textbox(lines=5, label="User Query"),
443
+ gr.Dropdown(["Detailed", "Concise", "Creative", "Technical"], label="Retreival Style"),
444
+ gr.Markdown("#Retreival Method"),
445
+ gr.Mardown("##advanced_fusion")
 
 
446
  ],
447
  outputs=gr.Textbox(label="RAG Response"),
448
  title="Chance RAG"