Dannyar608 commited on
Commit
a97e196
·
verified ·
1 Parent(s): e2d5741

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -65
app.py CHANGED
@@ -42,7 +42,7 @@ def extract_transcript_info(df):
42
  info['Courses'] = list(set([c[0].strip() for c in courses]))
43
  return info
44
 
45
- # Learning style questions - from educationplanner.org
46
  learning_style_questions = [
47
  "When you are learning something new, you prefer to:",
48
  "When you are at home, you like to:",
@@ -87,68 +87,7 @@ def learning_style_quiz(*answers):
87
 
88
  return ", ".join(best_styles)
89
 
90
- # PanoramaEd categories and multiple choice questions
91
- get_to_know_categories = {
92
- "All About Me": [
93
- ("What’s your favorite way to spend a day off?", []),
94
- ("If you could only eat one food for the rest of your life, what would it be?", []),
95
- ("Do you have any pets? If so, what are their names?", []),
96
- ("If you could travel anywhere in the world, where would you go?", []),
97
- ("What’s your favorite holiday or tradition?", []),
98
- ("What are some of your favorite movies or shows?", []),
99
- ("Do you have a favorite book or book series? Why?", []),
100
- ("Who is a character from a show, book, or movie that you relate to? Why?", []),
101
- ("If you could be any fictional character, who would you be and why?", [])
102
- ],
103
- "Hopes and Dreams": [
104
- ("What do you want to be when you grow up?", []),
105
- ("What’s something you hope to achieve this year?", []),
106
- ("If you could change the world in one way, what would you do?", []),
107
- ("What are you most proud of?", []),
108
- ("What’s a big dream you have for your future?", [])
109
- ],
110
- "School Life": [
111
- ("What’s your favorite subject in school?", []),
112
- ("What’s something that makes learning easier for you?", []),
113
- ("Do you prefer working alone or in groups?", []),
114
- ("What helps you feel confident in class?", []),
115
- ("What’s something you’re good at in school?", [])
116
- ],
117
- "Relationships": [
118
- ("Who do you look up to and why?", []),
119
- ("Who is someone that makes you feel safe and supported?", []),
120
- ("Do you have a best friend? What do you like to do together?", []),
121
- ("What’s one thing you wish people knew about you?", []),
122
- ("What’s something kind you’ve done for someone else?", [])
123
- ]
124
- }
125
-
126
- def generate_learning_plan(info):
127
- level = info.get("Grade_Level", "unknown")
128
- courses = info.get("Courses", [])
129
- gpa = info.get("GPA", info.get("Unweighted_GPA", "N/A"))
130
- return f"""
131
- 📘 **Personalized Learning Plan**
132
- - Grade Level: {level}
133
- - GPA: {gpa}
134
- - Suggested Focus Areas: {', '.join(courses[:3]) if courses else 'N/A'}
135
- - Goals: Strengthen key subjects, explore interests, and build study habits.
136
- """
137
-
138
- def generate_learning_style_summary(style):
139
- return f"""
140
- 🧠 **Learning Style Summary**
141
- You are a **{style}** learner. That means you learn best through {"visual aids like charts and images" if "Visual" in style else "listening and verbal instruction" if "Auditory" in style else "reading and writing-based methods"}.
142
- """
143
-
144
- def generate_motivation_section(responses):
145
- hopes = [ans for q, ans in responses.items() if "hope" in q.lower() or "dream" in q.lower()]
146
- return f"""
147
- 💡 **Motivational Summary**
148
- Your dreams are powerful: {'; '.join(hopes) if hopes else 'You are filled with potential!'}.
149
- Believe in yourself and keep moving forward.
150
- """
151
-
152
  def save_profile(file, *inputs):
153
  try:
154
  if not file:
@@ -195,8 +134,8 @@ def save_profile(file, *inputs):
195
  with open("student_summary.md", "w") as f:
196
  f.write(summary["Learning_Plan"] + '\n' + summary["Style_Summary"] + '\n' + summary["Motivation"])
197
 
198
- # Reset the inputs
199
- return f"✅ Profile saved! Your learning style is: {learning_type}", *[gr.update(value="") for _ in inputs]
200
 
201
  except Exception as e:
202
  return f"❌ Error: {str(e)}"
 
42
  info['Courses'] = list(set([c[0].strip() for c in courses]))
43
  return info
44
 
45
+ # Learning style questions
46
  learning_style_questions = [
47
  "When you are learning something new, you prefer to:",
48
  "When you are at home, you like to:",
 
87
 
88
  return ", ".join(best_styles)
89
 
90
+ # Save profile function
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  def save_profile(file, *inputs):
92
  try:
93
  if not file:
 
134
  with open("student_summary.md", "w") as f:
135
  f.write(summary["Learning_Plan"] + '\n' + summary["Style_Summary"] + '\n' + summary["Motivation"])
136
 
137
+ # Reset the inputs and clear the fields
138
+ return f"✅ Profile saved! Your learning style is: {learning_type}", *[gr.update(value="") for _ in inputs] + [gr.update(value=None) for _ in inputs]
139
 
140
  except Exception as e:
141
  return f"❌ Error: {str(e)}"