Spaces:
Sleeping

IndujaMuthu commited on
Commit
eaad5ff
Β·
verified Β·
1 Parent(s): ce40eda

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +83 -0
app.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[4]:
5
+
6
+
7
+ import gradio as gr
8
+
9
+ def recommend(age, grade, study_hours, sleep_hours, junk_food_score, activity_level, interests):
10
+ # Convert inputs to correct types
11
+ age = int(age)
12
+ study_hours = float(study_hours)
13
+ sleep_hours = float(sleep_hours)
14
+ junk_food_score = int(junk_food_score)
15
+ interests = interests.lower()
16
+
17
+ # 🎭 Extracurricular Recommendation
18
+ if "music" in interests:
19
+ extracurricular = "Join a music club or explore online classes."
20
+ elif "drawing" in interests:
21
+ extracurricular = "Join an art or sketching group."
22
+ elif "sports" in interests:
23
+ extracurricular = "Try for the school team or join local sports academies."
24
+ else:
25
+ extracurricular = "Explore school clubs that match your interest."
26
+
27
+ # πŸŽ“ Academic Feedback
28
+ if study_hours >= 5:
29
+ academic_feedback = "Excellent dedication! Keep up the good work."
30
+ elif study_hours >= 3:
31
+ academic_feedback = "Good progress. Slight improvement in time management recommended."
32
+ else:
33
+ academic_feedback = "Needs to focus more on studies."
34
+
35
+ # 🍽 Food Lifestyle
36
+ if junk_food_score > 7:
37
+ food_advice = "High junk intake. Reduce snacks and drink more water."
38
+ elif junk_food_score > 4:
39
+ food_advice = "Moderate junk intake. Watch portions and increase fruits/veggies."
40
+ else:
41
+ food_advice = "Healthy diet. Keep it up!"
42
+
43
+ # 😴 Attitude Suggestion
44
+ if sleep_hours >= 8:
45
+ attitude = "Great rest habits. Maintain consistency!"
46
+ elif sleep_hours >= 6:
47
+ attitude = "Stable but can improve with better rest."
48
+ else:
49
+ attitude = "Low rest. Try to improve your sleep schedule for better focus."
50
+
51
+ # Final response
52
+ return (
53
+ f"🎭 Recommended Extracurricular Activity: {extracurricular}\n\n"
54
+ f"πŸŽ“ Academic Performance Feedback: {academic_feedback}\n\n"
55
+ f"🍽 Food Lifestyle Advice: {food_advice}\n\n"
56
+ f"😴 Attitude Suggestion: {attitude}"
57
+ )
58
+
59
+ # Gradio UI
60
+ demo = gr.Interface(
61
+ fn=recommend,
62
+ inputs=[
63
+ gr.Number(label="Age"),
64
+ gr.Textbox(label="Grade"),
65
+ gr.Textbox(label="Study Hours (e.g. 3.5)"),
66
+ gr.Textbox(label="Sleep Hours (e.g. 6.5)"),
67
+ gr.Textbox(label="Junk Food Score (1-10)"),
68
+ gr.Dropdown(["Low", "Medium", "High"], label="Activity Level"),
69
+ gr.Textbox(label="Interests (comma separated, e.g. music, drawing)")
70
+ ],
71
+ outputs="text",
72
+ title="πŸŽ“ Student Recommendation System",
73
+ description="Enter student details to get dynamic recommendations on extracurriculars, academics, food lifestyle, and attitude."
74
+ )
75
+
76
+ demo.launch()
77
+
78
+
79
+ # In[ ]:
80
+
81
+
82
+
83
+