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

app updated

Browse files
Files changed (1) hide show
  1. app.py +30 -29
app.py CHANGED
@@ -103,35 +103,36 @@ if uploaded_files is None:
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})
 
103
  st.info("Upload files to analyze")
104
 
105
  elif uploaded_files:
106
+ with st.spinner("Wait for it... 🤔"):
107
+ # Process the uploaded files to extract text and source information
108
+ textify_output = read_and_textify(uploaded_files)
109
 
110
+ # Separate the output into documents (text) and their corresponding sources
111
+ documents, sources = textify_output
112
 
113
+ # Call the function
114
+ query_database = list_to_nums(documents)
115
 
116
+ # Create reference table
117
+ refs_tab = query_search(
118
+ "pful for understanding federal income", documents, query_database, sources
119
+ )
120
+ refs_tab.head(math.ceil(top_n))
121
+
122
+ # React to user input
123
+ if prompt := st.chat_input("What is up?"):
124
+ # Display user message in chat message container
125
+ st.chat_message("user").markdown(prompt)
126
+ # Add user message to chat history
127
+ st.session_state.messages.append({"role": "user", "content": prompt})
128
+
129
+ result = refs_tab
130
+
131
+ # Display assistant response in chat message container
132
+ with st.chat_message("assistant"):
133
+ if not use_dict_format:
134
+ st.table(result)
135
+ else:
136
+ st.write(result.to_json())
137
+ # Add assistant response to chat history
138
+ st.session_state.messages.append({"role": "assistant", "content": result})