Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,7 +104,20 @@ def learning_style_quiz(*answers):
|
|
| 104 |
return f"You have multiple strong learning styles: {', '.join(dominant_styles)}"
|
| 105 |
|
| 106 |
# ========== PROFILE MANAGEMENT ==========
|
| 107 |
-
def save_profile(name, age, interests, transcript, learning_style,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
data = {
|
| 109 |
"name": name,
|
| 110 |
"age": age,
|
|
@@ -114,6 +127,7 @@ def save_profile(name, age, interests, transcript, learning_style, favorites, bl
|
|
| 114 |
"favorites": favorites,
|
| 115 |
"blog": blog
|
| 116 |
}
|
|
|
|
| 117 |
os.makedirs("student_profiles", exist_ok=True)
|
| 118 |
json_path = os.path.join("student_profiles", f"{name.replace(' ', '_')}_profile.json")
|
| 119 |
with open(json_path, "w") as f:
|
|
@@ -233,16 +247,13 @@ with gr.Blocks() as app:
|
|
| 233 |
|
| 234 |
save_btn.click(
|
| 235 |
save_profile,
|
| 236 |
-
inputs=[name, age, interests, transcript_data, learning_output,
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
"book": book, "book_reason": book_reason,
|
| 240 |
-
"character": character, "character_reason": character_reason},
|
| 241 |
-
blog_text],
|
| 242 |
outputs=save_output
|
| 243 |
)
|
| 244 |
|
| 245 |
-
#
|
| 246 |
with gr.Tab("🤖 Teaching Assistant"):
|
| 247 |
gr.Markdown("## Your Personalized Learning Assistant")
|
| 248 |
chatbot = gr.ChatInterface(
|
|
|
|
| 104 |
return f"You have multiple strong learning styles: {', '.join(dominant_styles)}"
|
| 105 |
|
| 106 |
# ========== PROFILE MANAGEMENT ==========
|
| 107 |
+
def save_profile(name, age, interests, transcript, learning_style,
|
| 108 |
+
movie, movie_reason, show, show_reason,
|
| 109 |
+
book, book_reason, character, character_reason, blog):
|
| 110 |
+
favorites = {
|
| 111 |
+
"movie": movie,
|
| 112 |
+
"movie_reason": movie_reason,
|
| 113 |
+
"show": show,
|
| 114 |
+
"show_reason": show_reason,
|
| 115 |
+
"book": book,
|
| 116 |
+
"book_reason": book_reason,
|
| 117 |
+
"character": character,
|
| 118 |
+
"character_reason": character_reason
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
data = {
|
| 122 |
"name": name,
|
| 123 |
"age": age,
|
|
|
|
| 127 |
"favorites": favorites,
|
| 128 |
"blog": blog
|
| 129 |
}
|
| 130 |
+
|
| 131 |
os.makedirs("student_profiles", exist_ok=True)
|
| 132 |
json_path = os.path.join("student_profiles", f"{name.replace(' ', '_')}_profile.json")
|
| 133 |
with open(json_path, "w") as f:
|
|
|
|
| 247 |
|
| 248 |
save_btn.click(
|
| 249 |
save_profile,
|
| 250 |
+
inputs=[name, age, interests, transcript_data, learning_output,
|
| 251 |
+
movie, movie_reason, show, show_reason,
|
| 252 |
+
book, book_reason, character, character_reason, blog_text],
|
|
|
|
|
|
|
|
|
|
| 253 |
outputs=save_output
|
| 254 |
)
|
| 255 |
|
| 256 |
+
# Teaching Assistant Tab
|
| 257 |
with gr.Tab("🤖 Teaching Assistant"):
|
| 258 |
gr.Markdown("## Your Personalized Learning Assistant")
|
| 259 |
chatbot = gr.ChatInterface(
|