TpsNandhini commited on
Commit
5293bd7
1 Parent(s): 65b1963

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +99 -51
app.py CHANGED
@@ -261,66 +261,113 @@ def home_page():
261
  st.write("Please enter employee details in the sidebar and click 'Submit' to view the performance report.")
262
  else:
263
  # After submission, show the report
264
- col1, col2 = st.columns(2)
265
-
266
- with col1:
267
- st.subheader("Performance Predictions")
268
- # Placeholder for performance prediction
269
- performance_score = np.random.randint(60, 100)
270
- st.metric("Predicted Performance", f"{performance_score}%", "4%")
271
-
272
- # Gauge chart for employee rating
273
- fig = go.Figure(go.Indicator(
274
- mode="gauge+number",
275
- value=performance_score,
276
- domain={'x': [0, 1], 'y': [0, 1]},
277
- title={'text': "Employee Rating"},
278
- gauge={
279
- 'axis': {'range': [None, 100]},
280
- 'steps': [
281
- {'range': [0, 60], 'color': "lightcoral"},
282
- {'range': [60, 80], 'color': "lightyellow"},
283
- {'range': [80, 100], 'color': "lightgreen"}],
284
- 'threshold': {
285
- 'line': {'color': "red", 'width': 4},
286
- 'thickness': 0.75,
287
- 'value': performance_score}}))
288
- st.plotly_chart(fig, use_container_width=True)
289
-
290
- with col2:
291
- st.subheader("Prediction Insights")
292
- st.write(f"Based on the analysis for Employee ID {employee_id}:")
293
- st.write(f"- Current performance is {'above' if performance_score > 80 else 'below'} average")
294
- st.write(f"- Key area for improvement: {'Training' if performance_score < 80 else 'Project Management'}")
295
- st.write(f"- Recommended action: {'Enroll in advanced skills program' if performance_score < 80 else 'Take on leadership role in upcoming project'}")
296
-
297
- st.markdown("<hr>", unsafe_allow_html=True)
298
-
299
- col3, col4 = st.columns(2)
300
-
301
- with col3:
302
- st.subheader("Key Factors Influencing Performance")
303
- factors = pd.DataFrame({
304
- 'Factor': ['Experience', 'Training', 'Projects', 'Teamwork'],
305
- 'Impact': [0.3, 0.25, 0.28, 0.17]
306
- })
307
- fig = px.bar(factors, x='Impact', y='Factor', orientation='h',
308
- color='Impact', color_continuous_scale='Viridis')
309
- fig.update_layout(height=400)
310
- st.plotly_chart(fig, use_container_width=True)
311
-
312
- with col4:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  st.subheader("Performance Trend")
314
- # Placeholder for performance trend
315
  dates = pd.date_range(start="2023-01-01", end="2023-12-31", freq="M")
316
  performance = np.random.randint(70, 100, size=len(dates))
317
  trend_data = pd.DataFrame({"Date": dates, "Performance": performance})
318
  fig = px.line(trend_data, x="Date", y="Performance",
319
  line_shape="spline", render_mode="svg")
320
  fig.update_traces(line_color='#1E88E5')
321
- fig.update_layout(height=400)
322
  st.plotly_chart(fig, use_container_width=True)
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  # Logout button
325
  if st.button("Logout"):
326
  st.session_state.login_successful = False
@@ -329,6 +376,7 @@ def home_page():
329
  st.experimental_rerun()
330
 
331
 
 
332
  # Main app logic
333
  if st.session_state.current_page == 'login':
334
  login()
 
261
  st.write("Please enter employee details in the sidebar and click 'Submit' to view the performance report.")
262
  else:
263
  # After submission, show the report
264
+ tab1, tab2 = st.tabs(["Performance Report", "Performance Insights"])
265
+
266
+ with tab1:
267
+ st.markdown("## Employee Performance Report")
268
+ st.markdown(f"**Employee Name:** {employee_name}")
269
+ st.markdown(f"**Employee ID:** {employee_id}")
270
+ st.markdown(f"**Age:** {employee_age}")
271
+ st.markdown(f"**Joining Date:** {employee_joining_date}")
272
+ st.markdown(f"**Last Appraisal Date:** {employee_last_appraisal_date}")
273
+ st.markdown("---")
274
+
275
+ col1, col2 = st.columns(2)
276
+
277
+ with col1:
278
+ performance_score = np.random.randint(60, 100)
279
+ st.metric("Predicted Performance", f"{performance_score}%", "4%")
280
+
281
+ def create_stylized_gauge_chart(performance_score):
282
+ colors = ['#FF4B4B', '#FFA14B', '#FFE74B', '#8DED8E', '#4BFF4B']
283
+
284
+ fig = go.Figure(go.Indicator(
285
+ mode="gauge+number",
286
+ value=performance_score,
287
+ domain={'x': [0, 1], 'y': [0, 1]},
288
+ title={'text': "Employee Performance", 'font': {'size': 24}},
289
+ gauge={
290
+ 'axis': {'range': [None, 100], 'tickwidth': 1, 'tickcolor': "darkblue"},
291
+ 'bar': {'color': "darkblue"},
292
+ 'bgcolor': "white",
293
+ 'borderwidth': 2,
294
+ 'bordercolor': "gray",
295
+ 'steps': [
296
+ {'range': [0, 20], 'color': colors[0]},
297
+ {'range': [20, 40], 'color': colors[1]},
298
+ {'range': [40, 60], 'color': colors[2]},
299
+ {'range': [60, 80], 'color': colors[3]},
300
+ {'range': [80, 100], 'color': colors[4]}
301
+ ],
302
+ 'threshold': {
303
+ 'line': {'color': "red", 'width': 4},
304
+ 'thickness': 0.75,
305
+ 'value': performance_score
306
+ }
307
+ }
308
+ ))
309
+
310
+ fig.update_layout(
311
+ font={'color': "darkblue", 'family': "Arial"},
312
+ height=300,
313
+ width=300,
314
+ margin=dict(l=20, r=20, t=30, b=20),
315
+ paper_bgcolor="white",
316
+ plot_bgcolor='rgba(0,0,0,0)'
317
+ )
318
+
319
+ return fig
320
+
321
+ fig = create_stylized_gauge_chart(performance_score)
322
+ st.plotly_chart(fig, use_container_width=True)
323
+
324
+ with col2:
325
+ st.subheader("Key Factors Influencing Performance")
326
+ factors = pd.DataFrame({
327
+ 'Factor': ['Experience', 'Training', 'Projects', 'Teamwork'],
328
+ 'Impact': [0.3, 0.25, 0.28, 0.17]
329
+ })
330
+ fig = px.bar(factors, x='Impact', y='Factor', orientation='h',
331
+ color='Impact', color_continuous_scale='Viridis')
332
+ fig.update_layout(height=300, margin=dict(l=20, r=20, t=30, b=20))
333
+ st.plotly_chart(fig, use_container_width=True)
334
+
335
+ st.markdown("---")
336
  st.subheader("Performance Trend")
 
337
  dates = pd.date_range(start="2023-01-01", end="2023-12-31", freq="M")
338
  performance = np.random.randint(70, 100, size=len(dates))
339
  trend_data = pd.DataFrame({"Date": dates, "Performance": performance})
340
  fig = px.line(trend_data, x="Date", y="Performance",
341
  line_shape="spline", render_mode="svg")
342
  fig.update_traces(line_color='#1E88E5')
343
+ fig.update_layout(height=300, margin=dict(l=20, r=20, t=30, b=20))
344
  st.plotly_chart(fig, use_container_width=True)
345
 
346
+ with tab2:
347
+ st.markdown("## Performance Insights")
348
+ st.write(f"Based on the analysis for Employee ID {employee_id}:")
349
+ st.write(f"- Current performance is {'above' if performance_score > 80 else 'below'} average")
350
+ st.write(f"- Key area for improvement: {'Training' if performance_score < 80 else 'Project Management'}")
351
+ st.write(f"- Recommended action: {'Enroll in advanced skills program' if performance_score < 80 else 'Take on leadership role in upcoming project'}")
352
+
353
+ st.markdown("### Detailed Analysis")
354
+ st.write("1. **Performance Trend:**")
355
+ st.write(" The employee's performance has shown a steady increase over the past year, with notable improvements in the last quarter.")
356
+
357
+ st.write("2. **Strengths:**")
358
+ st.write(" - Strong project management skills")
359
+ st.write(" - Excellent team collaboration")
360
+ st.write(" - High adaptability to new technologies")
361
+
362
+ st.write("3. **Areas for Improvement:**")
363
+ st.write(" - Time management in high-pressure situations")
364
+ st.write(" - Technical documentation skills")
365
+
366
+ st.write("4. **Recommendations:**")
367
+ st.write(" - Enroll in an advanced project management certification course")
368
+ st.write(" - Assign as a mentor for junior team members to further develop leadership skills")
369
+ st.write(" - Provide opportunities to lead cross-functional projects")
370
+
371
  # Logout button
372
  if st.button("Logout"):
373
  st.session_state.login_successful = False
 
376
  st.experimental_rerun()
377
 
378
 
379
+
380
  # Main app logic
381
  if st.session_state.current_page == 'login':
382
  login()