Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| # Function to generate the form and allow downloading | |
| def generate_form(): | |
| st.title("IT, AI, and ML Training Topics Survey") | |
| # Creating the form inputs | |
| student_name = st.text_input("Enter Your Name:") | |
| student_email = st.text_input("Enter Your Email:") | |
| # Multi-select for IT, AI, ML topics | |
| it_topics = st.multiselect( | |
| "Select topics you're interested in under IT:", | |
| ["Cloud Computing", "Networking", "Cybersecurity", "Web Development", "Software Engineering", "Database Management"] | |
| ) | |
| ai_ml_topics = st.multiselect( | |
| "Select topics you're interested in under AI/ML:", | |
| ["Deep Learning", "Natural Language Processing", "Computer Vision", "Reinforcement Learning", "Data Science", "Neural Networks"] | |
| ) | |
| # Preparing the data for download | |
| if st.button("Generate Form"): | |
| if student_name and student_email: | |
| # Save the data to a DataFrame | |
| data = { | |
| "Name": [student_name], | |
| "Email": [student_email], | |
| "IT Topics": [", ".join(it_topics)], | |
| "AI/ML Topics": [", ".join(ai_ml_topics)], | |
| } | |
| df = pd.DataFrame(data) | |
| # Provide a download button | |
| st.download_button( | |
| label="Download Your Form as CSV", | |
| data=df.to_csv(index=False).encode('utf-8'), | |
| file_name="survey_results.csv", | |
| mime="text/csv" | |
| ) | |
| else: | |
| st.error("Please fill in your name and email.") | |
| # Call the function to generate the form | |
| generate_form() | |