itachi-ai commited on
Commit
c973271
·
verified ·
1 Parent(s): 4850728

updated app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -9,11 +9,11 @@ def respond(message, chat_history, collection_name):
9
  return "", chat_history
10
 
11
 
12
- def embed_and_store(password, collection_name, file_type, file_fields, context):
13
  if password == config['PASSWORD_DB']:
14
  if str(file_type)== 'string':
15
  file_fields = context
16
- vector_db = VectorDataBase(file_fields, collection_name, file_type)
17
  vector_db.embedding_with_loop()
18
  return "", ""
19
  else:
@@ -51,13 +51,14 @@ with gr.Blocks() as demo:
51
  with gr.Row():
52
  password = gr.Textbox(label='Enter the Password')
53
  collection_name = gr.Textbox(label='Collection Name')
 
54
  file_type = gr.Dropdown(['PDF', 'TEXT', 'STRING'], label='Select File Type',
55
  value = 'PDF')
56
  file_fields = gr.File(visible = True, interactive=True)
57
  context = gr.Textbox(label="Enter the Context", visible = False)
58
  btn = gr.Button("Submit")
59
 
60
- btn.click(embed_and_store, inputs=[password, collection_name, file_type, file_fields, context], outputs=[file_fields, context])
61
  file_type.change(update_interface, inputs=[file_type], outputs=[context, file_fields])
62
  gr.Markdown("""
63
  <div align='center'>It could be helpful for making RAG applications</div>
 
9
  return "", chat_history
10
 
11
 
12
+ def embed_and_store(password, collection_name, file_type, file_fields, context,page_start):
13
  if password == config['PASSWORD_DB']:
14
  if str(file_type)== 'string':
15
  file_fields = context
16
+ vector_db = VectorDataBase(file_fields, collection_name, file_type, page_start=page_start)
17
  vector_db.embedding_with_loop()
18
  return "", ""
19
  else:
 
51
  with gr.Row():
52
  password = gr.Textbox(label='Enter the Password')
53
  collection_name = gr.Textbox(label='Collection Name')
54
+ page_start = gr.Textbox(label='Page Start')
55
  file_type = gr.Dropdown(['PDF', 'TEXT', 'STRING'], label='Select File Type',
56
  value = 'PDF')
57
  file_fields = gr.File(visible = True, interactive=True)
58
  context = gr.Textbox(label="Enter the Context", visible = False)
59
  btn = gr.Button("Submit")
60
 
61
+ btn.click(embed_and_store, inputs=[password, collection_name, file_type, file_fields, context,page_start], outputs=[file_fields, context])
62
  file_type.change(update_interface, inputs=[file_type], outputs=[context, file_fields])
63
  gr.Markdown("""
64
  <div align='center'>It could be helpful for making RAG applications</div>