import streamlit as st # Ensure Streamlit is imported first import matplotlib.pyplot as plt # Page configuration st.set_page_config(page_title="PEC Generative AI Training Survey Results", layout="centered") # Data for the survey labels = ['Yes', 'No', 'No Answer Provided'] values = [85.60, 14.20, 0.21] colors = ['#4CAF50', '#FF5722', '#9E9E9E'] # Colors for bars # Create the bar chart def create_bar_chart(): plt.figure(figsize=(8, 6)) plt.bar(labels, values, color=colors) # Adding a title and labels plt.title("PEC Generative AI Training Survey Results", fontsize=14) plt.xlabel("Responses", fontsize=12) plt.ylabel("Percentage", fontsize=12) # Setting the y-axis limit for clarity plt.ylim(0, 100) # Adding value labels above the bars for i, value in enumerate(values): plt.text(i, value + 1, f"{value}%", ha='center', fontsize=11) # Display grid lines for better readability plt.grid(axis='y', linestyle='--', alpha=0.7) # Tight layout for better spacing plt.tight_layout() # Return the chart as a Streamlit figure return plt # Streamlit app interface st.title("PEC Generative AI Training Survey Results") st.write("This chart represents the responses to the question: **'Were you able to learn, practice, and build a complete application by yourself?'**") # Display chart st.pyplot(create_bar_chart())