scmlewis commited on
Commit
3169aa3
Β·
verified Β·
1 Parent(s): a6ec92d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -34
app.py CHANGED
@@ -1,5 +1,5 @@
1
  # app.py
2
- # Modern Dark Mode Streamlit Application for AI Talent Screening (FINAL - Logic Fix for DataFrame Renaming)
3
 
4
  import streamlit as st
5
  # Import necessary libraries
@@ -12,7 +12,6 @@ import time
12
  import pandas as pd
13
  import PyPDF2
14
  from docx import Document
15
- # The matplotlib import is correctly REMOVED
16
  import plotly.express as px # Import Plotly for stable charting
17
 
18
  # Set page config with modern dark theme and wide layout
@@ -318,7 +317,7 @@ def classify_and_summarize_batch(resume, job_description, _bert_tokenized, _t5_i
318
  elif detected_skills: final_summary = f"Key Skills: {', '.join(detected_skills)}"
319
  else: final_summary = f"Experience: {exp_match.group(0).capitalize() if exp_match else 'Unknown'}"
320
 
321
- # Color codes based on theme
322
  if suitability == "Relevant": color = "#4CAF50"
323
  elif suitability == "Irrelevant": color = "#F44336"
324
  else: color = "#FFC107"
@@ -400,7 +399,7 @@ def render_sidebar():
400
  - Enter the **Job Description** (JD). Be clear about required skills and experience (e.g., '5 years+').
401
 
402
  **2. Upload Candidates (Tab 2)**:
403
- - Upload or paste up to **5 Candidate Profiles** (PDF/DOCX/Text).
404
  - Profiles must contain key technical skills and explicit experience.
405
 
406
  **3. Run Screening**:
@@ -454,7 +453,7 @@ def main():
454
 
455
  # --- TAB 2: Manage Resumes ---
456
  with tab_resumes:
457
- st.markdown(f"## πŸ“ Upload Candidate Profiles ({len(st.session_state.resumes)}/5)")
458
  st.info("Upload or paste candidate text below. The AI requires **key technical skills and experience statements** to function.")
459
 
460
  # Manage resume inputs
@@ -499,7 +498,7 @@ def main():
499
  st.markdown("<br>", unsafe_allow_html=True)
500
  col_add, col_remove, _ = st.columns([1, 1, 3])
501
  with col_add:
502
- if st.button("βž• Add Candidate Slot", use_container_width=True) and len(st.session_state.resumes) < 5:
503
  st.session_state.resumes.append("")
504
  st.rerun()
505
  with col_remove:
@@ -642,37 +641,23 @@ def main():
642
  # --- Detailed Report Table ---
643
  st.markdown("### πŸ“‹ Detailed Screening Results")
644
 
645
- # 1. Define the styling function.
646
- def style_suitability_row(row):
647
- color_column = 'Suitability_Color'
648
- if row[color_column] == '#4CAF50': # Relevant - Green
649
- return ['background-color: rgba(76, 175, 80, 0.15)'] * len(row)
650
- elif row[color_column] == '#F44336': # Irrelevant/Error - Red
651
- return ['background-color: rgba(244, 67, 54, 0.15)'] * len(row)
652
- elif row[color_column] == '#FFC107': # Uncertain - Yellow
653
- return ['background-color: rgba(255, 193, 7, 0.15)'] * len(row)
654
- else:
655
- return [''] * len(row)
656
-
657
- # 2. **FIX**: Rename columns on the DataFrame before applying style.
658
- display_df = results_df.rename(
659
  columns={
660
- 'Data/Tech Related Skills Summary': 'PROFILE SUMMARY',
661
- 'Warning': 'FLAGGING REASON',
662
- 'Resume': 'PROFILE ID',
663
- 'Suitability': 'SUITABILITY'
664
  }
665
  )
666
 
667
- # 3. Apply row styling to the renamed DataFrame.
668
- styled_df = display_df.style.apply(style_suitability_row, axis=1)
669
-
670
- # 4. Remove the internal color column from display (Fix for visible color column)
671
- styled_df = styled_df.hide(subset=['Suitability_Color'], axis=1)
672
-
673
- # 5. Display the styled DataFrame.
674
  st.dataframe(
675
- styled_df,
676
  use_container_width=True
677
  )
678
 
@@ -698,8 +683,7 @@ def main():
698
  if st.session_state.valid_resumes:
699
  fig = generate_skill_pie_chart(st.session_state.valid_resumes)
700
  if fig:
701
- # Use st.plotly_chart for flicker-free display
702
- st.plotly_chart(fig, use_container_width=True)
703
  else:
704
  st.info("No recognized technical skills found in the profiles for charting.")
705
  else:
 
1
  # app.py
2
+ # Modern Dark Mode Streamlit Application for AI Talent Screening (FINAL - Remove Coloring, Increase Max Profiles to 7)
3
 
4
  import streamlit as st
5
  # Import necessary libraries
 
12
  import pandas as pd
13
  import PyPDF2
14
  from docx import Document
 
15
  import plotly.express as px # Import Plotly for stable charting
16
 
17
  # Set page config with modern dark theme and wide layout
 
317
  elif detected_skills: final_summary = f"Key Skills: {', '.join(detected_skills)}"
318
  else: final_summary = f"Experience: {exp_match.group(0).capitalize() if exp_match else 'Unknown'}"
319
 
320
+ # Color codes based on theme (STILL NEEDED for the scorecards/tiles and CSV)
321
  if suitability == "Relevant": color = "#4CAF50"
322
  elif suitability == "Irrelevant": color = "#F44336"
323
  else: color = "#FFC107"
 
399
  - Enter the **Job Description** (JD). Be clear about required skills and experience (e.g., '5 years+').
400
 
401
  **2. Upload Candidates (Tab 2)**:
402
+ - Upload or paste up to **7 Candidate Profiles** (PDF/DOCX/Text). <-- **UPDATED TO 7**
403
  - Profiles must contain key technical skills and explicit experience.
404
 
405
  **3. Run Screening**:
 
453
 
454
  # --- TAB 2: Manage Resumes ---
455
  with tab_resumes:
456
+ st.markdown(f"## πŸ“ Upload Candidate Profiles ({len(st.session_state.resumes)}/7)") # <-- **UPDATED TO 7**
457
  st.info("Upload or paste candidate text below. The AI requires **key technical skills and experience statements** to function.")
458
 
459
  # Manage resume inputs
 
498
  st.markdown("<br>", unsafe_allow_html=True)
499
  col_add, col_remove, _ = st.columns([1, 1, 3])
500
  with col_add:
501
+ if st.button("βž• Add Candidate Slot", use_container_width=True) and len(st.session_state.resumes) < 7: # <-- **UPDATED TO 7**
502
  st.session_state.resumes.append("")
503
  st.rerun()
504
  with col_remove:
 
641
  # --- Detailed Report Table ---
642
  st.markdown("### πŸ“‹ Detailed Screening Results")
643
 
644
+ # **FIX**: Explicitly drop the 'Suitability_Color' column to ensure it is not displayed,
645
+ # and remove all cell coloring logic.
646
+ display_df = results_df.drop(columns=['Suitability_Color'])
647
+
648
+ # Rename columns for professional display
649
+ display_df = display_df.rename(
 
 
 
 
 
 
 
 
650
  columns={
651
+ 'Data/Tech Related Skills Summary': '**PROFILE SUMMARY**',
652
+ 'Warning': '**FLAGGING REASON**',
653
+ 'Resume': '**PROFILE ID**',
654
+ 'Suitability': '**SUITABILITY**'
655
  }
656
  )
657
 
658
+ # Display the simple, unstyled DataFrame
 
 
 
 
 
 
659
  st.dataframe(
660
+ display_df,
661
  use_container_width=True
662
  )
663
 
 
683
  if st.session_state.valid_resumes:
684
  fig = generate_skill_pie_chart(st.session_state.valid_resumes)
685
  if fig:
686
+ st.plotly_chart(fig, use_container_width=True)
 
687
  else:
688
  st.info("No recognized technical skills found in the profiles for charting.")
689
  else: