Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
# Page configuration
|
| 4 |
+
st.set_page_config(page_title="PEC Generative AI Training Survey Results", layout="centered")
|
| 5 |
+
|
| 6 |
+
# Data for the survey
|
| 7 |
+
labels = ['Yes', 'No', 'No Answer Provided']
|
| 8 |
+
values = [85.60, 14.20, 0.21]
|
| 9 |
+
colors = ['#4CAF50', '#FF5722', '#9E9E9E'] # Colors for bars
|
| 10 |
+
|
| 11 |
+
# Create the bar chart
|
| 12 |
+
def create_bar_chart():
|
| 13 |
+
plt.figure(figsize=(8, 6))
|
| 14 |
+
plt.bar(labels, values, color=colors)
|
| 15 |
+
|
| 16 |
+
# Adding a title and labels
|
| 17 |
+
plt.title("PEC Generative AI Training Survey Results", fontsize=14)
|
| 18 |
+
plt.xlabel("Responses", fontsize=12)
|
| 19 |
+
plt.ylabel("Percentage", fontsize=12)
|
| 20 |
+
|
| 21 |
+
# Setting the y-axis limit for clarity
|
| 22 |
+
plt.ylim(0, 100)
|
| 23 |
+
|
| 24 |
+
# Adding value labels above the bars
|
| 25 |
+
for i, value in enumerate(values):
|
| 26 |
+
plt.text(i, value + 1, f"{value}%", ha='center', fontsize=11)
|
| 27 |
+
|
| 28 |
+
# Display grid lines for better readability
|
| 29 |
+
plt.grid(axis='y', linestyle='--', alpha=0.7)
|
| 30 |
+
|
| 31 |
+
# Tight layout for better spacing
|
| 32 |
+
plt.tight_layout()
|
| 33 |
+
|
| 34 |
+
# Return the chart as a Streamlit figure
|
| 35 |
+
return plt
|
| 36 |
+
|
| 37 |
+
# Streamlit app interface
|
| 38 |
+
st.title("PEC Generative AI Training Survey Results")
|
| 39 |
+
st.write("This chart represents the responses to the question: **'Were you able to learn, practice, and build a complete application by yourself?'**")
|
| 40 |
+
|
| 41 |
+
# Display chart
|
| 42 |
+
st.pyplot(create_bar_chart())
|