eagle0504 commited on
Commit
f5a20b7
β€’
1 Parent(s): 1f08ed4

app updated

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
 
3
  import openai
@@ -7,8 +8,8 @@ from openai import OpenAI
7
 
8
  from helper.utils import *
9
 
10
- st.set_page_config(layout="centered", page_title="Document SearchπŸ€–πŸ“–")
11
- st.header("Document SearchπŸ€–πŸ“–")
12
  st.write("---")
13
 
14
 
@@ -19,7 +20,7 @@ with st.sidebar:
19
  # Display the instruction manual for the Document Data Chatbot in a formatted markdown
20
  st.markdown(
21
  """
22
- # Document Data Chatbot User Manual πŸ€–πŸ’Š
23
 
24
  Welcome to the Document Data Chatbot, your interactive assistant for information on the textual "Document Data". This chatbot offers quick and accurate responses to your queries. Follow these steps to interact with the chatbot:
25
 
@@ -56,6 +57,9 @@ with st.sidebar:
56
  "Upload documents", accept_multiple_files=True, type=["txt", "pdf"]
57
  )
58
 
 
 
 
59
  # Clear button
60
  clear_button = st.sidebar.button("Clear Conversation", key="clear")
61
 
@@ -87,7 +91,7 @@ if uploaded_files is None:
87
 
88
  elif uploaded_files:
89
  # Inform the user how many documents have been loaded
90
- st.sidebar.write(f"{len(uploaded_files)} document(s) loaded..")
91
 
92
  # Process the uploaded files to extract text and source information
93
  textify_output = read_and_textify(uploaded_files)
@@ -102,6 +106,7 @@ elif uploaded_files:
102
  refs_tab = query_search(
103
  "pful for understanding federal income", documents, query_database, sources
104
  )
 
105
 
106
  # React to user input
107
  if prompt := st.chat_input("What is up?"):
 
1
+ import math
2
  import os
3
 
4
  import openai
 
8
 
9
  from helper.utils import *
10
 
11
+ st.set_page_config(layout="wide", page_title="Document Search using QIMπŸ€–πŸ“–")
12
+ st.header("Document Search using Quantized Influence Measure (QIM)πŸ€–πŸ“–")
13
  st.write("---")
14
 
15
 
 
20
  # Display the instruction manual for the Document Data Chatbot in a formatted markdown
21
  st.markdown(
22
  """
23
+ # Document Data Chatbot User Manual πŸ€–πŸ“–
24
 
25
  Welcome to the Document Data Chatbot, your interactive assistant for information on the textual "Document Data". This chatbot offers quick and accurate responses to your queries. Follow these steps to interact with the chatbot:
26
 
 
57
  "Upload documents", accept_multiple_files=True, type=["txt", "pdf"]
58
  )
59
 
60
+ # Input filter
61
+ top_n = st.number_input("Insert a number (top n rows to be selected):")
62
+
63
  # Clear button
64
  clear_button = st.sidebar.button("Clear Conversation", key="clear")
65
 
 
91
 
92
  elif uploaded_files:
93
  # Inform the user how many documents have been loaded
94
+ st.sidebar.success(f"{len(uploaded_files)} document(s) loaded...")
95
 
96
  # Process the uploaded files to extract text and source information
97
  textify_output = read_and_textify(uploaded_files)
 
106
  refs_tab = query_search(
107
  "pful for understanding federal income", documents, query_database, sources
108
  )
109
+ refs_tab.head(math.ceil(top_n))
110
 
111
  # React to user input
112
  if prompt := st.chat_input("What is up?"):