TpsNandhini commited on
Commit
3dc462d
β€’
1 Parent(s): 51f1ca5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -59
app.py CHANGED
@@ -138,6 +138,7 @@ st.markdown("""
138
 
139
  # Login page
140
  def login():
 
141
  st.markdown('<p class="big-font">Performance Nexus 🎯</p>', unsafe_allow_html=True)
142
 
143
  col1, col2, col3 = st.columns([1, 2, 1])
@@ -225,8 +226,6 @@ def reset_password_page():
225
  st.error("Enter new password and confirm password.")
226
  elif new_password != re_password:
227
  st.error("Passwords do not match. Please re-enter.")
228
- elif len(new_password) <= 3:
229
- st.error("Password too short")
230
  else:
231
  reset_password(username, new_password)
232
  st.success("Password reset successful. You can now login with your new password.")
@@ -241,23 +240,17 @@ def reset_password_page():
241
  st.session_state.current_page = 'login'
242
  st.experimental_rerun()
243
 
244
- rotating_images = ["homepageimage1.webp", "homepageimage2.webp", "homepageimage3.png"]
245
-
246
  def home_page():
247
- st.markdown('<p style="color: #1E88E5; font-size: 24px; font-weight: bold; text-align: center;">'
248
- f'Welcome to the Performance Nexus Dashboard, {st.session_state.username}!</p>',
249
- unsafe_allow_html=True)
250
 
251
- # Display rotating images
252
- for image_path in rotating_images:
253
- st.image(image_path, use_column_width=True)
254
- st.markdown("<br>", unsafe_allow_html=True)
255
- st.markdown("<hr>", unsafe_allow_html=True)
256
 
257
  # Sidebar for user input
258
  st.sidebar.header("Input Parameters")
259
  employee_name = st.sidebar.text_input("Employee Name", "")
260
- employee_id = st.sidebar.number_input("Employee ID", min_value=1, max_value=1000, value=1)
261
  employee_age = st.sidebar.number_input("Employee Age", min_value=18, max_value=100, value=25)
262
  employee_joining_date = st.sidebar.date_input("Employee Joining Date", datetime.date.today())
263
  employee_last_appraisal_date = st.sidebar.date_input("Last Appraisal Date", datetime.date.today())
@@ -269,49 +262,48 @@ def home_page():
269
 
270
  # Main dashboard area
271
  if st.session_state.get('submitted', False):
272
- col1, col2 = st.columns(2)
273
-
274
- with col1:
275
- st.subheader("Employee Performance Score")
276
- # Placeholder for performance prediction
277
- performance_score = np.random.randint(60, 100)
278
- st.metric("Predicted Performance", f"{performance_score}%", "4%")
279
-
280
- st.subheader("Key Factors Influencing Performance")
281
- factors = pd.DataFrame({
282
- 'Factor': ['Experience', 'Training', 'Projects', 'Teamwork'],
283
- 'Impact': [0.3, 0.25, 0.28, 0.17]
284
- })
285
- fig = px.bar(factors, x='Impact', y='Factor', orientation='h')
286
- st.plotly_chart(fig)
287
-
288
- with col2:
289
- st.subheader("Performance Trend")
290
- # Placeholder for performance trend
291
- dates = pd.date_range(start="2023-01-01", end="2023-12-31", freq="M")
292
- performance = np.random.randint(70, 100, size=len(dates))
293
- trend_data = pd.DataFrame({"Date": dates, "Performance": performance})
294
- fig = px.line(trend_data, x="Date", y="Performance")
295
- st.plotly_chart(fig)
296
-
297
- # Gauge chart for employee rating
298
- st.subheader("Employee Rating")
299
- fig = go.Figure(go.Indicator(
300
- mode = "gauge+number",
301
- value = performance_score,
302
- domain = {'x': [0, 1], 'y': [0, 1]},
303
- title = {'text': "Employee Rating"},
304
- gauge = {
305
- 'axis': {'range': [None, 100]},
306
- 'steps' : [
307
- {'range': [0, 60], 'color': "lightgray"},
308
- {'range': [60, 80], 'color': "gray"},
309
- {'range': [80, 100], 'color': "green"}],
310
- 'threshold' : {
311
- 'line': {'color': "red", 'width': 4},
312
- 'thickness': 0.75,
313
- 'value': performance_score}}))
314
- st.plotly_chart(fig)
315
 
316
  # Additional insights
317
  st.subheader("Performance Insights")
@@ -328,9 +320,6 @@ def home_page():
328
  st.experimental_rerun()
329
 
330
  # Main app logic
331
- if 'current_page' not in st.session_state:
332
- st.session_state.current_page = 'login'
333
-
334
  if st.session_state.current_page == 'login':
335
  login()
336
  elif st.session_state.current_page == 'sign_up':
 
138
 
139
  # Login page
140
  def login():
141
+ st.image("performance_nexus_logo.png", use_column_width=True)
142
  st.markdown('<p class="big-font">Performance Nexus 🎯</p>', unsafe_allow_html=True)
143
 
144
  col1, col2, col3 = st.columns([1, 2, 1])
 
226
  st.error("Enter new password and confirm password.")
227
  elif new_password != re_password:
228
  st.error("Passwords do not match. Please re-enter.")
 
 
229
  else:
230
  reset_password(username, new_password)
231
  st.success("Password reset successful. You can now login with your new password.")
 
240
  st.session_state.current_page = 'login'
241
  st.experimental_rerun()
242
 
243
+ # Home page
 
244
  def home_page():
245
+ st.markdown('<p class="big-font">Welcome to the Performance Nexus Dashboard, {st.session_state.username}!</p>', unsafe_allow_html=True)
 
 
246
 
247
+ st.image("homepageimage.png", use_column_width=True)
248
+ st.markdown("<hr>", unsafe_allow_html=True)
 
 
 
249
 
250
  # Sidebar for user input
251
  st.sidebar.header("Input Parameters")
252
  employee_name = st.sidebar.text_input("Employee Name", "")
253
+ employee_id = st.sidebar.text_input("Employee ID", "")
254
  employee_age = st.sidebar.number_input("Employee Age", min_value=18, max_value=100, value=25)
255
  employee_joining_date = st.sidebar.date_input("Employee Joining Date", datetime.date.today())
256
  employee_last_appraisal_date = st.sidebar.date_input("Last Appraisal Date", datetime.date.today())
 
262
 
263
  # Main dashboard area
264
  if st.session_state.get('submitted', False):
265
+ st.markdown("<br>", unsafe_allow_html=True)
266
+ st.markdown("<hr>", unsafe_allow_html=True)
267
+
268
+ st.subheader("Employee Performance Score")
269
+ # Placeholder for performance prediction
270
+ performance_score = np.random.randint(60, 100)
271
+ st.metric("Predicted Performance", f"{performance_score}%", "4%")
272
+
273
+ st.subheader("Key Factors Influencing Performance")
274
+ factors = pd.DataFrame({
275
+ 'Factor': ['Experience', 'Training', 'Projects', 'Teamwork'],
276
+ 'Impact': [0.3, 0.25, 0.28, 0.17]
277
+ })
278
+ fig = px.bar(factors, x='Impact', y='Factor', orientation='h')
279
+ st.plotly_chart(fig, use_container_width=True)
280
+
281
+ st.subheader("Performance Trend")
282
+ # Placeholder for performance trend
283
+ dates = pd.date_range(start="2023-01-01", end="2023-12-31", freq="M")
284
+ performance = np.random.randint(70, 100, size=len(dates))
285
+ trend_data = pd.DataFrame({"Date": dates, "Performance": performance})
286
+ fig = px.line(trend_data, x="Date", y="Performance")
287
+ st.plotly_chart(fig, use_container_width=True)
288
+
289
+ # Gauge chart for employee rating
290
+ st.subheader("Employee Rating")
291
+ fig = go.Figure(go.Indicator(
292
+ mode="gauge+number",
293
+ value=performance_score,
294
+ domain={'x': [0, 1], 'y': [0, 1]},
295
+ title={'text': "Employee Rating"},
296
+ gauge={
297
+ 'axis': {'range': [None, 100]},
298
+ 'steps': [
299
+ {'range': [0, 60], 'color': "lightgray"},
300
+ {'range': [60, 80], 'color': "gray"},
301
+ {'range': [80, 100], 'color': "green"}],
302
+ 'threshold': {
303
+ 'line': {'color': "red", 'width': 4},
304
+ 'thickness': 0.75,
305
+ 'value': performance_score}}))
306
+ st.plotly_chart(fig, use_container_width=True)
 
307
 
308
  # Additional insights
309
  st.subheader("Performance Insights")
 
320
  st.experimental_rerun()
321
 
322
  # Main app logic
 
 
 
323
  if st.session_state.current_page == 'login':
324
  login()
325
  elif st.session_state.current_page == 'sign_up':