eagle0504 commited on
Commit
8961d80
1 Parent(s): 3b77f3a

default true

Browse files
Files changed (1) hide show
  1. app.py +30 -35
app.py CHANGED
@@ -67,10 +67,7 @@ with st.sidebar:
67
  )
68
 
69
  # Use dictionary
70
- use_dict_format = st.checkbox("Use dictionary format.")
71
-
72
- # Submit button
73
- submit_it = st.sidebar.button("Submit", type="primary")
74
 
75
  # Clear button
76
  clear_button = st.sidebar.button("Clear Conversation", key="clear")
@@ -105,38 +102,36 @@ if uploaded_files is None:
105
  # Display a message prompting the user to upload files
106
  st.info("Upload files to analyze")
107
 
108
-
109
  elif uploaded_files:
110
- if submit_it:
111
- # Process the uploaded files to extract text and source information
112
- textify_output = read_and_textify(uploaded_files)
113
 
114
- # Separate the output into documents (text) and their corresponding sources
115
- documents, sources = textify_output
116
 
117
- # Call the function
118
- query_database = list_to_nums(documents)
119
 
120
- # Create reference table
121
- refs_tab = query_search(
122
- "pful for understanding federal income", documents, query_database, sources
123
- )
124
- refs_tab.head(math.ceil(top_n))
125
-
126
- # React to user input
127
- if prompt := st.chat_input("What is up?"):
128
- # Display user message in chat message container
129
- st.chat_message("user").markdown(prompt)
130
- # Add user message to chat history
131
- st.session_state.messages.append({"role": "user", "content": prompt})
132
-
133
- result = refs_tab
134
-
135
- # Display assistant response in chat message container
136
- with st.chat_message("assistant"):
137
- if not use_dict_format:
138
- st.table(result)
139
- else:
140
- st.write(result.to_json())
141
- # Add assistant response to chat history
142
- st.session_state.messages.append({"role": "assistant", "content": result})
 
67
  )
68
 
69
  # Use dictionary
70
+ use_dict_format = st.checkbox("Use dictionary format.", value=True)
 
 
 
71
 
72
  # Clear button
73
  clear_button = st.sidebar.button("Clear Conversation", key="clear")
 
102
  # Display a message prompting the user to upload files
103
  st.info("Upload files to analyze")
104
 
 
105
  elif uploaded_files:
106
+ # Process the uploaded files to extract text and source information
107
+ textify_output = read_and_textify(uploaded_files)
 
108
 
109
+ # Separate the output into documents (text) and their corresponding sources
110
+ documents, sources = textify_output
111
 
112
+ # Call the function
113
+ query_database = list_to_nums(documents)
114
 
115
+ # Create reference table
116
+ refs_tab = query_search(
117
+ "pful for understanding federal income", documents, query_database, sources
118
+ )
119
+ refs_tab.head(math.ceil(top_n))
120
+
121
+ # React to user input
122
+ if prompt := st.chat_input("What is up?"):
123
+ # Display user message in chat message container
124
+ st.chat_message("user").markdown(prompt)
125
+ # Add user message to chat history
126
+ st.session_state.messages.append({"role": "user", "content": prompt})
127
+
128
+ result = refs_tab
129
+
130
+ # Display assistant response in chat message container
131
+ with st.chat_message("assistant"):
132
+ if not use_dict_format:
133
+ st.table(result)
134
+ else:
135
+ st.write(result.to_json())
136
+ # Add assistant response to chat history
137
+ st.session_state.messages.append({"role": "assistant", "content": result})