Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -138,7 +138,22 @@ learning_style_questions = [
|
|
138 |
"When you need directions to a new place, you prefer:",
|
139 |
"When you learn a new skill, you prefer to:",
|
140 |
"When you're trying to concentrate, you:",
|
141 |
-
"When you meet new people, you remember them by:"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
]
|
143 |
|
144 |
learning_style_options = [
|
@@ -146,7 +161,22 @@ learning_style_options = [
|
|
146 |
["Look at a map (Visual)", "Have someone tell you (Auditory)", "Write down directions (Reading/Writing)", "Try walking/driving there (Kinesthetic)"],
|
147 |
["Read instructions (Reading/Writing)", "Have someone show you (Visual)", "Listen to explanations (Auditory)", "Try it yourself (Kinesthetic)"],
|
148 |
["Need quiet (Reading/Writing)", "Need background noise (Auditory)", "Need to move around (Kinesthetic)", "Need visual stimulation (Visual)"],
|
149 |
-
["Their face (Visual)", "Their name (Auditory)", "What you talked about (Reading/Writing)", "What you did together (Kinesthetic)"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
]
|
151 |
|
152 |
def learning_style_quiz(*answers):
|
@@ -168,12 +198,56 @@ def learning_style_quiz(*answers):
|
|
168 |
scores["Kinesthetic"] += 1
|
169 |
|
170 |
max_score = max(scores.values())
|
171 |
-
|
172 |
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
else:
|
176 |
-
|
|
|
|
|
|
|
177 |
|
178 |
# ========== SAVE STUDENT PROFILE FUNCTION ==========
|
179 |
def save_profile(name, age, interests, transcript, learning_style, movie, movie_reason, show, show_reason, book, book_reason, character, character_reason, blog):
|
@@ -335,14 +409,14 @@ with gr.Blocks() as app:
|
|
335 |
transcript_file.change(fn=parse_transcript, inputs=transcript_file, outputs=[transcript_output, transcript_data])
|
336 |
|
337 |
with gr.Tab("Step 2: Learning Style Quiz"):
|
338 |
-
gr.Markdown("### Learning Style Quiz")
|
339 |
quiz_components = []
|
340 |
for i, (question, options) in enumerate(zip(learning_style_questions, learning_style_options)):
|
341 |
quiz_components.append(
|
342 |
gr.Radio(options, label=f"{i+1}. {question}")
|
343 |
)
|
344 |
|
345 |
-
learning_output = gr.Textbox(label="Learning Style Result")
|
346 |
gr.Button("Submit Quiz").click(
|
347 |
learning_style_quiz,
|
348 |
inputs=quiz_components,
|
|
|
138 |
"When you need directions to a new place, you prefer:",
|
139 |
"When you learn a new skill, you prefer to:",
|
140 |
"When you're trying to concentrate, you:",
|
141 |
+
"When you meet new people, you remember them by:",
|
142 |
+
"When you're assembling furniture or a gadget, you:",
|
143 |
+
"When choosing a restaurant, you rely most on:",
|
144 |
+
"When you're in a waiting room, you typically:",
|
145 |
+
"When giving someone instructions, you tend to:",
|
146 |
+
"When you're trying to recall information, you:",
|
147 |
+
"When you're at a museum or exhibit, you:",
|
148 |
+
"When you're learning a new language, you prefer:",
|
149 |
+
"When you're taking notes in class, you:",
|
150 |
+
"When you're explaining something complex, you:",
|
151 |
+
"When you're at a party, you enjoy:",
|
152 |
+
"When you're trying to remember a phone number, you:",
|
153 |
+
"When you're relaxing, you prefer to:",
|
154 |
+
"When you're learning to use new software, you:",
|
155 |
+
"When you're giving a presentation, you rely on:",
|
156 |
+
"When you're solving a difficult problem, you:"
|
157 |
]
|
158 |
|
159 |
learning_style_options = [
|
|
|
161 |
["Look at a map (Visual)", "Have someone tell you (Auditory)", "Write down directions (Reading/Writing)", "Try walking/driving there (Kinesthetic)"],
|
162 |
["Read instructions (Reading/Writing)", "Have someone show you (Visual)", "Listen to explanations (Auditory)", "Try it yourself (Kinesthetic)"],
|
163 |
["Need quiet (Reading/Writing)", "Need background noise (Auditory)", "Need to move around (Kinesthetic)", "Need visual stimulation (Visual)"],
|
164 |
+
["Their face (Visual)", "Their name (Auditory)", "What you talked about (Reading/Writing)", "What you did together (Kinesthetic)"],
|
165 |
+
["Read the instructions carefully (Reading/Writing)", "Look at the diagrams (Visual)", "Ask someone to explain (Auditory)", "Start putting pieces together (Kinesthetic)"],
|
166 |
+
["Online photos of the food (Visual)", "Recommendations from friends (Auditory)", "Reading the menu online (Reading/Writing)", "Remembering how it felt to eat there (Kinesthetic)"],
|
167 |
+
["Read magazines (Reading/Writing)", "Listen to music (Auditory)", "Watch TV (Visual)", "Fidget or move around (Kinesthetic)"],
|
168 |
+
["Write them down (Reading/Writing)", "Explain verbally (Auditory)", "Demonstrate (Visual)", "Guide them physically (Kinesthetic)"],
|
169 |
+
["See written words in your mind (Visual)", "Hear the information in your head (Auditory)", "Write it down to remember (Reading/Writing)", "Associate it with physical actions (Kinesthetic)"],
|
170 |
+
["Read all the descriptions (Reading/Writing)", "Listen to audio guides (Auditory)", "Look at the displays (Visual)", "Touch interactive exhibits (Kinesthetic)"],
|
171 |
+
["Study grammar rules (Reading/Writing)", "Listen to native speakers (Auditory)", "Use flashcards with images (Visual)", "Practice conversations (Kinesthetic)"],
|
172 |
+
["Write detailed paragraphs (Reading/Writing)", "Record the lecture (Auditory)", "Draw diagrams and charts (Visual)", "Doodle while listening (Kinesthetic)"],
|
173 |
+
["Write detailed steps (Reading/Writing)", "Explain verbally with examples (Auditory)", "Draw diagrams (Visual)", "Use physical objects to demonstrate (Kinesthetic)"],
|
174 |
+
["Conversations with people (Auditory)", "Watching others or the environment (Visual)", "Writing notes or texting (Reading/Writing)", "Dancing or physical activities (Kinesthetic)"],
|
175 |
+
["See the numbers in your head (Visual)", "Say them aloud (Auditory)", "Write them down (Reading/Writing)", "Dial them on a keypad (Kinesthetic)"],
|
176 |
+
["Read a book (Reading/Writing)", "Listen to music (Auditory)", "Watch TV/movies (Visual)", "Do something physical (Kinesthetic)"],
|
177 |
+
["Read the manual (Reading/Writing)", "Ask someone to show you (Visual)", "Call tech support (Auditory)", "Experiment with the software (Kinesthetic)"],
|
178 |
+
["Detailed notes (Reading/Writing)", "Verbal explanations (Auditory)", "Visual slides (Visual)", "Physical demonstrations (Kinesthetic)"],
|
179 |
+
["Write out possible solutions (Reading/Writing)", "Talk through it with someone (Auditory)", "Draw diagrams (Visual)", "Build a model or prototype (Kinesthetic)"]
|
180 |
]
|
181 |
|
182 |
def learning_style_quiz(*answers):
|
|
|
198 |
scores["Kinesthetic"] += 1
|
199 |
|
200 |
max_score = max(scores.values())
|
201 |
+
total_questions = len(learning_style_questions)
|
202 |
|
203 |
+
# Calculate percentages
|
204 |
+
percentages = {style: (score/total_questions)*100 for style, score in scores.items()}
|
205 |
+
|
206 |
+
# Sort styles by score (descending)
|
207 |
+
sorted_styles = sorted(scores.items(), key=lambda x: x[1], reverse=True)
|
208 |
+
|
209 |
+
# Prepare detailed results
|
210 |
+
result = "Your Learning Style Results:\n\n"
|
211 |
+
for style, score in sorted_styles:
|
212 |
+
result += f"{style}: {score}/{total_questions} ({percentages[style]:.1f}%)\n"
|
213 |
+
|
214 |
+
result += "\n"
|
215 |
+
|
216 |
+
# Determine primary and secondary styles
|
217 |
+
primary_styles = [style for style, score in scores.items() if score == max_score]
|
218 |
+
|
219 |
+
if len(primary_styles) == 1:
|
220 |
+
result += f"Your primary learning style is: {primary_styles[0]}\n\n"
|
221 |
+
# Add personalized tips based on primary style
|
222 |
+
if primary_styles[0] == "Visual":
|
223 |
+
result += "Tips for Visual Learners:\n"
|
224 |
+
result += "- Use color coding in your notes\n"
|
225 |
+
result += "- Create mind maps and diagrams\n"
|
226 |
+
result += "- Watch educational videos\n"
|
227 |
+
result += "- Use flashcards with images\n"
|
228 |
+
elif primary_styles[0] == "Auditory":
|
229 |
+
result += "Tips for Auditory Learners:\n"
|
230 |
+
result += "- Record lectures and listen to them\n"
|
231 |
+
result += "- Participate in study groups\n"
|
232 |
+
result += "- Explain concepts out loud to yourself\n"
|
233 |
+
result += "- Use rhymes or songs to remember information\n"
|
234 |
+
elif primary_styles[0] == "Reading/Writing":
|
235 |
+
result += "Tips for Reading/Writing Learners:\n"
|
236 |
+
result += "- Write detailed notes\n"
|
237 |
+
result += "- Create summaries in your own words\n"
|
238 |
+
result += "- Read textbooks and articles\n"
|
239 |
+
result += "- Make lists to organize information\n"
|
240 |
+
else: # Kinesthetic
|
241 |
+
result += "Tips for Kinesthetic Learners:\n"
|
242 |
+
result += "- Use hands-on activities\n"
|
243 |
+
result += "- Take frequent movement breaks\n"
|
244 |
+
result += "- Create physical models\n"
|
245 |
+
result += "- Associate information with physical actions\n"
|
246 |
else:
|
247 |
+
result += f"You have multiple strong learning styles: {', '.join(primary_styles)}\n\n"
|
248 |
+
result += "You may benefit from combining different learning approaches.\n"
|
249 |
+
|
250 |
+
return result
|
251 |
|
252 |
# ========== SAVE STUDENT PROFILE FUNCTION ==========
|
253 |
def save_profile(name, age, interests, transcript, learning_style, movie, movie_reason, show, show_reason, book, book_reason, character, character_reason, blog):
|
|
|
409 |
transcript_file.change(fn=parse_transcript, inputs=transcript_file, outputs=[transcript_output, transcript_data])
|
410 |
|
411 |
with gr.Tab("Step 2: Learning Style Quiz"):
|
412 |
+
gr.Markdown("### Learning Style Quiz (20 Questions)")
|
413 |
quiz_components = []
|
414 |
for i, (question, options) in enumerate(zip(learning_style_questions, learning_style_options)):
|
415 |
quiz_components.append(
|
416 |
gr.Radio(options, label=f"{i+1}. {question}")
|
417 |
)
|
418 |
|
419 |
+
learning_output = gr.Textbox(label="Learning Style Result", lines=10)
|
420 |
gr.Button("Submit Quiz").click(
|
421 |
learning_style_quiz,
|
422 |
inputs=quiz_components,
|