jkushwaha commited on
Commit
58094f1
·
verified ·
1 Parent(s): 1bd7f9e

Update onhold.py

Browse files
Files changed (1) hide show
  1. onhold.py +6 -17
onhold.py CHANGED
@@ -1,39 +1,34 @@
1
  def onhold():
2
- st.write("### Inpute Paths")
3
  PhaseData_path = st.text_input("Enter PhaseData Path:")
4
  Inbound_CSV_path = st.text_input("Enter Inbound_CSV Path:")
 
 
 
 
 
5
  inbound_df_path = 'inbound_issues_tempus_2_q2_new.csv'
6
  pif_list, image_path, auto_csv_path = path_setting(PhaseData_path, Inbound_CSV_path)
7
- # st.set_page_config(layout="wide") # Set layout to wide
8
 
9
- # Slider to adjust the width of the columns
10
  col1_width = st.sidebar.slider("Width of First Column", 0.1, 10.0, 2.0, 0.1)
11
  col2_width = st.sidebar.slider("Width of Second Column", 0.1, 10.0, 6.5, 0.1)
12
  col3_width = st.sidebar.slider("Width of Third Column", 0.1, 10.0, 5.0, 0.1)
13
 
14
- # Divide the screen into three vertical panels with specified widths
15
  col1, col2, col3 = st.columns([col1_width, col2_width, col3_width])
16
 
17
- # Document Selection Panel
18
  with col1:
19
  st.write("### Document Selection")
20
  global doc_index
21
  doc_index = st.number_input("Select Document Index", min_value=1, max_value=len(pif_list)+1, step=1, value=1)
22
- # doc_index = st.select_slider("Select Document ID", options=range(len(pif_list)))
23
  document_id = pif_list[doc_index-1]
24
  st.write("Current Document ID: ", document_id)
25
- # document_id = st.selectbox("Select Document ID", options=pif_list)
26
  pages = [int(i.split('-')[-1].split('.')[0]) for i in glob(f"{image_path}{document_id}*.png")]
27
  page_number = st.number_input("Page Number", min_value=1, max_value=len(pages), step=1, value=1)
28
  df_tmp = pd.read_csv(glob(f"{auto_csv_path}*{document_id}*auto.csv")[0])
29
  reason_for_onhold = st.text_area("Reason for On-hold: ", value="Add a reason for onhold column into inbound CSV")
30
  add_comment = st.text_area("Total Number of BMs: ", value=df_tmp.shape[0])
31
 
32
- # Display Image Panel
33
  with col2:
34
- # st.write("### Inpute Paths")
35
- # PhaseData_path = st.text_input("Enter PhaseData Path:")
36
- # Inbound_CSV_path = st.text_input("Enter Inbound_CSV Path:")
37
  st.write("### Display Image")
38
  im_path = load_image(image_path, document_id, page_number)
39
  if im_path:
@@ -41,7 +36,6 @@ def onhold():
41
  else:
42
  st.write("Image not found")
43
 
44
- # Display DataFrame Panel
45
  with col3:
46
  st.write("### Display DataFrame")
47
  df = load_dataframe(auto_csv_path, document_id, page_number)
@@ -49,18 +43,13 @@ def onhold():
49
  columns_to_display = st.multiselect("Select Columns to Display", df.columns)
50
  if len(columns_to_display) > 0:
51
  st.write(df[columns_to_display])
52
-
53
- # Input area for comments and suggestions
54
  st.subheader("Add Comments on NLP Output")
55
  reco_list = ['Regular NLP working', 'Wrong Report type', 'Report not Found',
56
  'Dev work required', 'NLP not supported (non 5 labs)',
57
  'Limited Regular NLP Support and Manual NLP (ROI) is working',
58
  'Poor quality report- NLP not supported']
59
- # comment = st.text_area("Add your comment here")
60
  comment = st.selectbox("Select Comment", options=reco_list)
61
  add_comment = st.text_area("Add your additional comment here")
62
-
63
- # Save comments and suggestions to CSV when submitted
64
  if st.button("Submit"):
65
  global comments_df
66
  data = {
 
1
  def onhold():
2
+ st.write("### Input Paths")
3
  PhaseData_path = st.text_input("Enter PhaseData Path:")
4
  Inbound_CSV_path = st.text_input("Enter Inbound_CSV Path:")
5
+
6
+ if not PhaseData_path or not Inbound_CSV_path:
7
+ st.warning("Please enter both PhaseData Path and Inbound_CSV Path.")
8
+ return
9
+
10
  inbound_df_path = 'inbound_issues_tempus_2_q2_new.csv'
11
  pif_list, image_path, auto_csv_path = path_setting(PhaseData_path, Inbound_CSV_path)
 
12
 
 
13
  col1_width = st.sidebar.slider("Width of First Column", 0.1, 10.0, 2.0, 0.1)
14
  col2_width = st.sidebar.slider("Width of Second Column", 0.1, 10.0, 6.5, 0.1)
15
  col3_width = st.sidebar.slider("Width of Third Column", 0.1, 10.0, 5.0, 0.1)
16
 
 
17
  col1, col2, col3 = st.columns([col1_width, col2_width, col3_width])
18
 
 
19
  with col1:
20
  st.write("### Document Selection")
21
  global doc_index
22
  doc_index = st.number_input("Select Document Index", min_value=1, max_value=len(pif_list)+1, step=1, value=1)
 
23
  document_id = pif_list[doc_index-1]
24
  st.write("Current Document ID: ", document_id)
 
25
  pages = [int(i.split('-')[-1].split('.')[0]) for i in glob(f"{image_path}{document_id}*.png")]
26
  page_number = st.number_input("Page Number", min_value=1, max_value=len(pages), step=1, value=1)
27
  df_tmp = pd.read_csv(glob(f"{auto_csv_path}*{document_id}*auto.csv")[0])
28
  reason_for_onhold = st.text_area("Reason for On-hold: ", value="Add a reason for onhold column into inbound CSV")
29
  add_comment = st.text_area("Total Number of BMs: ", value=df_tmp.shape[0])
30
 
 
31
  with col2:
 
 
 
32
  st.write("### Display Image")
33
  im_path = load_image(image_path, document_id, page_number)
34
  if im_path:
 
36
  else:
37
  st.write("Image not found")
38
 
 
39
  with col3:
40
  st.write("### Display DataFrame")
41
  df = load_dataframe(auto_csv_path, document_id, page_number)
 
43
  columns_to_display = st.multiselect("Select Columns to Display", df.columns)
44
  if len(columns_to_display) > 0:
45
  st.write(df[columns_to_display])
 
 
46
  st.subheader("Add Comments on NLP Output")
47
  reco_list = ['Regular NLP working', 'Wrong Report type', 'Report not Found',
48
  'Dev work required', 'NLP not supported (non 5 labs)',
49
  'Limited Regular NLP Support and Manual NLP (ROI) is working',
50
  'Poor quality report- NLP not supported']
 
51
  comment = st.selectbox("Select Comment", options=reco_list)
52
  add_comment = st.text_area("Add your additional comment here")
 
 
53
  if st.button("Submit"):
54
  global comments_df
55
  data = {