ashischakraborty commited on
Commit
4c318b5
·
verified ·
1 Parent(s): e2b0927

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -95,7 +95,7 @@ def main():
95
  uploaded_extintl_file_insight = st.file_uploader("Upload a External Reg Intel", type="pdf")
96
  uploaded_interintel_file_insight = st.file_uploader("Upload a Internal Reg Intel", type="pdf")
97
  if uploaded_extintl_file_insight is not None and uploaded_interintel_file_insight is not None:
98
- uploaded_file_SOP = st.file_uploader("Upload an SOP file", type="pdf")
99
  if uploaded_file_SOP is not None:
100
  # Extract insight document
101
  with st.spinner("Processing External Reg Intel"):
@@ -113,11 +113,11 @@ def main():
113
  st.write(f"The PDF contains **{token_count_insight}** tokens.")
114
 
115
 
116
- # Extract SOP document
117
- with st.spinner("Processing the SOP Text..."):
118
  text_SOP, page_texts_SOP = extract_text_from_pdf(uploaded_file_SOP)
119
  token_count_SOP, _ = count_tokens_with_tiktoken(text_SOP)
120
- st.sidebar.success("SOP file successfully processed")
121
  st.write("Token Count")
122
  st.write(f"The PDF contains **{token_count_SOP}** tokens.")
123
 
@@ -138,12 +138,12 @@ def main():
138
  st.write(df_ii_insight_chunks)
139
 
140
 
141
- # Process SOP into chunks
142
- with st.spinner("Processing the SOP Document..."):
143
  df_input_SOP = pd.DataFrame([{ "Title": uploaded_file_SOP.name, "Text": text_SOP, "PageTexts": page_texts_SOP }])
144
  df_sop_chunks = split_dataframe_with_combined_text_and_pages(df_input_SOP, 10000, 1000)
145
- st.write("Processed SOP")
146
- st.sidebar.success("Processed SOP")
147
  st.write(df_sop_chunks)
148
 
149
  # Evaluate Document
@@ -186,22 +186,22 @@ def main():
186
  return
187
 
188
  # Comparing to Insights
189
- with st.spinner("Comparing Impact Classified Insights To SOP"):
190
  df_compare = process_compare(filtered_insights_on_impact, df_sop_chunks, topic)
191
- st.subheader("Comparison of Insights to SOP's")
192
- st.sidebar.success("Comparison of External Intel to SOP's Complete")
193
  st.write(df_compare)
194
  filtered_comparisons_df = df_compare[df_compare['ReviewNeeded'] == True]
195
  if filtered_comparisons_df.empty:
196
- st.write("No reviews needed for this SOP")
197
- st.sidebar.error("No reviews needed for this SOP")
198
  return
199
 
200
  # Risk scoring
201
- with st.spinner("Risk Assessing Insights To SOP"):
202
  df_risks = risk_score_process(filtered_comparisons_df, topic)
203
- st.subheader("Risk Score of Insights to SOP's")
204
- st.sidebar.success("Risk Score of Insights to SOP's Completed")
205
  st.write(df_risks)
206
 
207
 
 
95
  uploaded_extintl_file_insight = st.file_uploader("Upload a External Reg Intel", type="pdf")
96
  uploaded_interintel_file_insight = st.file_uploader("Upload a Internal Reg Intel", type="pdf")
97
  if uploaded_extintl_file_insight is not None and uploaded_interintel_file_insight is not None:
98
+ uploaded_file_SOP = st.file_uploader("Upload the draft submission file", type="pdf")
99
  if uploaded_file_SOP is not None:
100
  # Extract insight document
101
  with st.spinner("Processing External Reg Intel"):
 
113
  st.write(f"The PDF contains **{token_count_insight}** tokens.")
114
 
115
 
116
+ # Extract draft submission document
117
+ with st.spinner("Processing the draft submission file Text..."):
118
  text_SOP, page_texts_SOP = extract_text_from_pdf(uploaded_file_SOP)
119
  token_count_SOP, _ = count_tokens_with_tiktoken(text_SOP)
120
+ st.sidebar.success("draft submission file successfully processed")
121
  st.write("Token Count")
122
  st.write(f"The PDF contains **{token_count_SOP}** tokens.")
123
 
 
138
  st.write(df_ii_insight_chunks)
139
 
140
 
141
+ # Process draft submission file into chunks
142
+ with st.spinner("Processing the draft submission file..."):
143
  df_input_SOP = pd.DataFrame([{ "Title": uploaded_file_SOP.name, "Text": text_SOP, "PageTexts": page_texts_SOP }])
144
  df_sop_chunks = split_dataframe_with_combined_text_and_pages(df_input_SOP, 10000, 1000)
145
+ st.write("Processed draft submission file")
146
+ st.sidebar.success("Processed draft submission file")
147
  st.write(df_sop_chunks)
148
 
149
  # Evaluate Document
 
186
  return
187
 
188
  # Comparing to Insights
189
+ with st.spinner("Comparing Impact Classified Insights To draft submission file"):
190
  df_compare = process_compare(filtered_insights_on_impact, df_sop_chunks, topic)
191
+ st.subheader("Comparison of Insights to draft submission file's")
192
+ st.sidebar.success("Comparison of External & Internal Intel to draft submission file's Complete")
193
  st.write(df_compare)
194
  filtered_comparisons_df = df_compare[df_compare['ReviewNeeded'] == True]
195
  if filtered_comparisons_df.empty:
196
+ st.write("No reviews needed for this draft submission file")
197
+ st.sidebar.error("No reviews needed for this draft submission file")
198
  return
199
 
200
  # Risk scoring
201
+ with st.spinner("Risk Assessing Insights To draft submission file"):
202
  df_risks = risk_score_process(filtered_comparisons_df, topic)
203
+ st.subheader("Risk Score of Insights to draft submission file's")
204
+ st.sidebar.success("Risk Score of Insights to draft submission file's Completed")
205
  st.write(df_risks)
206
 
207