Update app.py
Browse files
app.py
CHANGED
|
@@ -32,176 +32,96 @@ skills_pattern = re.compile(r'\b(?:' + '|'.join(map(re.escape, [
|
|
| 32 |
|
| 33 |
normalize_pattern = re.compile(r'_|-|,\s*collaborated in agile teams|,\s*developed solutions for|,\s*led projects involving|,\s*designed applications with|,\s*built machine learning models for|,\s*implemented data pipelines for|,\s*deployed cloud-based solutions|,\s*optimized workflows for|,\s*contributed to data-driven projects')
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
|
| 37 |
-
st.session_state.theme = 'light'
|
| 38 |
-
|
| 39 |
-
# Apply custom CSS with dark mode support, background image, and scrollable sidebar
|
| 40 |
-
st.markdown(f"""
|
| 41 |
<style>
|
| 42 |
-
/* Define CSS variables for light and dark themes */
|
| 43 |
-
:root {{
|
| 44 |
-
--background-color: {'#F5F5F5' if st.session_state.theme == 'light' else '#1E1E1E'};
|
| 45 |
-
--sidebar-bg: {'#FFFFFF' if st.session_state.theme == 'light' else '#2D2D2D'};
|
| 46 |
-
--text-color: {'#4A4A4A' if st.session_state.theme == 'light' else '#D3D3D3'};
|
| 47 |
-
--header-color: #FF3621;
|
| 48 |
-
--element-bg: {'#FFFFFF' if st.session_state.theme == 'light' else '#333333'};
|
| 49 |
-
--element-border: {'#E0E0E0' if st.session_state.theme == 'light' else '#444444'};
|
| 50 |
-
--element-text: {'#4A4A4A' if st.session_state.theme == 'light' else '#D3D3D3'};
|
| 51 |
-
--element-header-bg: #FF3621;
|
| 52 |
-
--element-header-text: #FFFFFF;
|
| 53 |
-
--button-hover-bg: {'#FF6347' if st.session_state.theme == 'light' else '#FF6347'};
|
| 54 |
-
}}
|
| 55 |
-
|
| 56 |
-
/* General App Styling */
|
| 57 |
-
.stApp {{
|
| 58 |
-
background-color: var(--background-color);
|
| 59 |
-
font-family: 'Arial', sans-serif;
|
| 60 |
-
position: relative;
|
| 61 |
-
background-image: url('https://images.unsplash.com/photo-1516321313936-161e50f54a4e?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80'); /* Tech-themed background */
|
| 62 |
-
background-size: cover;
|
| 63 |
-
background-position: center;
|
| 64 |
-
background-repeat: no-repeat;
|
| 65 |
-
background-attachment: fixed;
|
| 66 |
-
}}
|
| 67 |
-
|
| 68 |
-
/* Dim background image with overlay */
|
| 69 |
-
.stApp::before {{
|
| 70 |
-
content: '';
|
| 71 |
-
position: absolute;
|
| 72 |
-
top: 0;
|
| 73 |
-
left: 0;
|
| 74 |
-
width: 100%;
|
| 75 |
-
height: 100%;
|
| 76 |
-
background: rgba(0, 0, 0, 0.3); /* Dim overlay */
|
| 77 |
-
z-index: -1;
|
| 78 |
-
}}
|
| 79 |
-
|
| 80 |
-
/* Ensure content is readable */
|
| 81 |
-
.stApp > div {{
|
| 82 |
-
position: relative;
|
| 83 |
-
z-index: 1;
|
| 84 |
-
}}
|
| 85 |
-
|
| 86 |
/* Sidebar Styling */
|
| 87 |
-
[data-testid="stSidebar"] {
|
| 88 |
width: 350px !important;
|
| 89 |
-
background-color: var(--sidebar-bg);
|
| 90 |
-
border-right: 1px solid var(--element-border);
|
| 91 |
-
position: fixed;
|
| 92 |
-
top: 0;
|
| 93 |
-
left: 0;
|
| 94 |
-
max-height: 100vh; /* Constrain to viewport height */
|
| 95 |
-
overflow-y: auto; /* Enable vertical scrolling */
|
| 96 |
-
padding-bottom: 20px; /* Add padding to prevent content cutoff */
|
| 97 |
-
}}
|
| 98 |
-
[data-testid="stSidebarCollapseButton"] {{ /* Hide toggle button */
|
| 99 |
-
display: none !important;
|
| 100 |
-
}}
|
| 101 |
-
.stSidebar {{
|
| 102 |
min-width: 350px !important;
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
}
|
| 110 |
-
.stSidebar p {{
|
| 111 |
-
color: var(--text-color);
|
| 112 |
-
font-size: 16px;
|
| 113 |
-
}}
|
| 114 |
-
|
| 115 |
-
/* Expander Styling */
|
| 116 |
-
[data-testid="stExpander"] summary {{
|
| 117 |
-
font-size: 26px !important;
|
| 118 |
-
font-weight: bold !important;
|
| 119 |
-
color: var(--header-color) !important;
|
| 120 |
-
white-space: nowrap !important;
|
| 121 |
-
}}
|
| 122 |
-
.st-expander-content p {{
|
| 123 |
-
font-size: 12px !important;
|
| 124 |
-
color: var(--text-color) !important;
|
| 125 |
-
}}
|
| 126 |
|
| 127 |
/* Main Content Styling */
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
| 130 |
font-weight: bold;
|
| 131 |
margin-top: 20px;
|
| 132 |
-
}
|
| 133 |
|
| 134 |
/* Input Fields */
|
| 135 |
-
.stTextInput > label {
|
| 136 |
-
color: var(--text-color);
|
| 137 |
font-weight: bold;
|
| 138 |
font-size: 16px;
|
| 139 |
-
}
|
| 140 |
-
.stTextInput > div > input {
|
| 141 |
-
border: 1px solid var(--
|
| 142 |
border-radius: 5px;
|
| 143 |
padding: 8px;
|
| 144 |
font-size: 14px;
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
}}
|
| 148 |
-
.stTextInput > div > input::placeholder {{
|
| 149 |
color: #888888;
|
| 150 |
-
}
|
| 151 |
|
| 152 |
/* Buttons */
|
| 153 |
-
.stButton > button {
|
| 154 |
-
background-color: var(--header-color); /* Databricks orange */
|
| 155 |
-
color: #FFFFFF;
|
| 156 |
border-radius: 5px;
|
| 157 |
padding: 10px 20px;
|
| 158 |
font-size: 16px;
|
| 159 |
border: none;
|
| 160 |
-
}
|
| 161 |
-
.stButton > button:hover {
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
}}
|
| 165 |
|
| 166 |
/* Results Table */
|
| 167 |
-
|
| 168 |
-
border: 1px solid var(--
|
| 169 |
border-radius: 5px;
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
color: var(--element-header-text);
|
| 175 |
font-weight: bold;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
color: var(--
|
| 179 |
-
}
|
| 180 |
|
| 181 |
/* Alerts */
|
| 182 |
-
.stAlert {
|
| 183 |
border-radius: 5px;
|
| 184 |
-
}
|
| 185 |
|
| 186 |
/* Pie Chart Section */
|
| 187 |
-
.stPlotlyChart, .stImage {
|
| 188 |
-
background-color: var(--element-bg);
|
| 189 |
border-radius: 5px;
|
| 190 |
padding: 10px;
|
| 191 |
-
}
|
| 192 |
</style>
|
| 193 |
""", unsafe_allow_html=True)
|
| 194 |
|
| 195 |
# Theme toggle button
|
| 196 |
def toggle_theme():
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
# Place the toggle button in the main content area (top-right)
|
| 200 |
col1, col2 = st.columns([9, 1])
|
| 201 |
with col2:
|
| 202 |
-
if st.button(f"Switch to {'Dark' if st.
|
| 203 |
toggle_theme()
|
| 204 |
-
st.rerun()
|
| 205 |
|
| 206 |
# Helper functions
|
| 207 |
def normalize_text(text):
|
|
@@ -410,7 +330,7 @@ def generate_skill_pie_chart(resumes):
|
|
| 410 |
colors = plt.cm.Blues(np.linspace(0.4, 0.8, len(labels)))
|
| 411 |
ax.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=90, colors=colors, textprops={'fontsize': 10})
|
| 412 |
ax.axis('equal')
|
| 413 |
-
plt.title("Skill Frequency Across Resumes", fontsize=12,
|
| 414 |
|
| 415 |
st.session_state.pie_chart_time = time.time() - start_time
|
| 416 |
return fig
|
|
|
|
| 32 |
|
| 33 |
normalize_pattern = re.compile(r'_|-|,\s*collaborated in agile teams|,\s*developed solutions for|,\s*led projects involving|,\s*designed applications with|,\s*built machine learning models for|,\s*implemented data pipelines for|,\s*deployed cloud-based solutions|,\s*optimized workflows for|,\s*contributed to data-driven projects')
|
| 34 |
|
| 35 |
+
# Apply custom CSS for layout stability and element styling
|
| 36 |
+
st.markdown("""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
/* Sidebar Styling */
|
| 39 |
+
[data-testid="stSidebar"] {
|
| 40 |
width: 350px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
min-width: 350px !important;
|
| 42 |
+
max-height: 100vh;
|
| 43 |
+
overflow-y: auto;
|
| 44 |
+
padding-bottom: 20px;
|
| 45 |
+
}
|
| 46 |
+
[data-testid="stSidebarCollapseButton"] {
|
| 47 |
+
display: none !important;
|
| 48 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
/* Main Content Styling */
|
| 51 |
+
.block-container {
|
| 52 |
+
margin-left: 350px;
|
| 53 |
+
}
|
| 54 |
+
h2, h3 {
|
| 55 |
+
color: var(--primaryColor);
|
| 56 |
font-weight: bold;
|
| 57 |
margin-top: 20px;
|
| 58 |
+
}
|
| 59 |
|
| 60 |
/* Input Fields */
|
| 61 |
+
.stTextInput > label {
|
|
|
|
| 62 |
font-weight: bold;
|
| 63 |
font-size: 16px;
|
| 64 |
+
}
|
| 65 |
+
.stTextInput > div > input {
|
| 66 |
+
border: 1px solid var(--secondaryBackgroundColor);
|
| 67 |
border-radius: 5px;
|
| 68 |
padding: 8px;
|
| 69 |
font-size: 14px;
|
| 70 |
+
}
|
| 71 |
+
.stTextInput > div > input::placeholder {
|
|
|
|
|
|
|
| 72 |
color: #888888;
|
| 73 |
+
}
|
| 74 |
|
| 75 |
/* Buttons */
|
| 76 |
+
.stButton > button {
|
|
|
|
|
|
|
| 77 |
border-radius: 5px;
|
| 78 |
padding: 10px 20px;
|
| 79 |
font-size: 16px;
|
| 80 |
border: none;
|
| 81 |
+
}
|
| 82 |
+
.stButton > button:hover {
|
| 83 |
+
border: 1px solid var(--textColor);
|
| 84 |
+
}
|
|
|
|
| 85 |
|
| 86 |
/* Results Table */
|
| 87 |
+
div[data-testid="stDataFrame"] {
|
| 88 |
+
border: 1px solid var(--secondaryBackgroundColor);
|
| 89 |
border-radius: 5px;
|
| 90 |
+
}
|
| 91 |
+
div[data-testid="stDataFrame"] table th {
|
| 92 |
+
background-color: var(--primaryColor);
|
| 93 |
+
color: var(--textColor);
|
|
|
|
| 94 |
font-weight: bold;
|
| 95 |
+
}
|
| 96 |
+
div[data-testid="stDataFrame"] table td {
|
| 97 |
+
color: var(--textColor);
|
| 98 |
+
}
|
| 99 |
|
| 100 |
/* Alerts */
|
| 101 |
+
.stAlert {
|
| 102 |
border-radius: 5px;
|
| 103 |
+
}
|
| 104 |
|
| 105 |
/* Pie Chart Section */
|
| 106 |
+
.stPlotlyChart, .stImage {
|
|
|
|
| 107 |
border-radius: 5px;
|
| 108 |
padding: 10px;
|
| 109 |
+
}
|
| 110 |
</style>
|
| 111 |
""", unsafe_allow_html=True)
|
| 112 |
|
| 113 |
# Theme toggle button
|
| 114 |
def toggle_theme():
|
| 115 |
+
current_theme = st.config.get_option("theme.base")
|
| 116 |
+
new_theme = "dark" if current_theme == "light" else "light"
|
| 117 |
+
st.config.set_option("theme.base", new_theme)
|
| 118 |
+
st.rerun()
|
| 119 |
|
| 120 |
# Place the toggle button in the main content area (top-right)
|
| 121 |
col1, col2 = st.columns([9, 1])
|
| 122 |
with col2:
|
| 123 |
+
if st.button(f"Switch to {'Dark' if st.config.get_option('theme.base') == 'light' else 'Light'} Mode", key="theme_toggle"):
|
| 124 |
toggle_theme()
|
|
|
|
| 125 |
|
| 126 |
# Helper functions
|
| 127 |
def normalize_text(text):
|
|
|
|
| 330 |
colors = plt.cm.Blues(np.linspace(0.4, 0.8, len(labels)))
|
| 331 |
ax.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=90, colors=colors, textprops={'fontsize': 10})
|
| 332 |
ax.axis('equal')
|
| 333 |
+
plt.title("Skill Frequency Across Resumes", fontsize=12, pad=10)
|
| 334 |
|
| 335 |
st.session_state.pie_chart_time = time.time() - start_time
|
| 336 |
return fig
|