Manikandan-Alagu commited on
Commit
a59c712
·
verified ·
1 Parent(s): 064ad85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -79
app.py CHANGED
@@ -1,79 +1,77 @@
1
- import gradio as gr
2
- from Backend import process_and_generate_report # Import backend functions
3
-
4
- with gr.Blocks() as iface:
5
- gr.Markdown("## <div style='text-align: center;'>AI-DRIVEN DROPOUT PREDICTION AND PREVENTION TOOL</div>")
6
-
7
- with gr.Row():
8
- with gr.Column():
9
- inputs = {}
10
-
11
- gr.Markdown("### Basic Information")
12
- with gr.Row():
13
- inputs["roll_no"] = gr.Textbox(label="Roll No")
14
- inputs["semester"] = gr.Dropdown(label="Semester", choices=["I", "II", "III", "IV", "V", "VI", "VII", "VIII"], interactive=True)
15
-
16
- gr.Markdown("### Degree Information")
17
- inputs["degree"] = gr.Dropdown(label="Degree", choices=[
18
- "B.E. - ELECTRONICS AND INSTRUMENTATION ENGINEERING",
19
- "B.E. - ELECTRONICS AND COMMUNICATION ENGINEERING",
20
- "B.E. - ELECTRICAL AND ELECTRONICS ENGINEERING",
21
- "B.E. - COMPUTER SCIENCE AND ENGINEERING",
22
- "B.E. - MECHANICAL ENGINEERING",
23
- "B.E. - MECHATRONICS ENGINEERING",
24
- "B.Tech. - AGRICULTURAL ENGINEERING",
25
- "B.Tech. - ARTIFICIAL INTELLIGENCE AND DATA SCIENCE",
26
- "B.Tech. - ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING",
27
- "B.Tech. - COMPUTER SCIENCE AND BUSINESS SYSTEMS",
28
- "B.Tech. - INFORMATION TECHNOLOGY","B.Tech. - BIOTECHNOLOGY",
29
- ], interactive=True)
30
-
31
- inputs["special_lab"] = gr.Dropdown(label="Special Lab", choices=["Active", "Non-Active"], interactive=True)
32
-
33
- gr.Markdown("### Academic Performance")
34
- with gr.Row():
35
- inputs["attendance_percentage"] = gr.Number(label="Attendance Percentage", minimum=0, maximum=100)
36
- inputs["formative_assessment"] = gr.Number(label="Formative Assessment (Academic %)", minimum=0, maximum=100)
37
-
38
- with gr.Row():
39
- inputs["cgpa"] = gr.Number(label="CGPA", minimum=0, maximum=10)
40
- inputs["current_sgpa"] = gr.Number(label="Current SGPA", minimum=0, maximum=10)
41
- inputs["arrear_count"] = gr.Number(label="Arrear Count", minimum=0, maximum=48)
42
-
43
- gr.Markdown("### Placement and Assessments")
44
- with gr.Row():
45
- inputs["placement_fa"] = gr.Number(label="Placement FA %", minimum=0, maximum=100)
46
- inputs["placement_cumulative"] = gr.Number(label="Placement Cumulative", minimum=0, maximum=100)
47
- inputs["placement_Attendence"] = gr.Number(label="Placement Attendance", minimum=0, maximum=100)
48
- inputs["interim_assessment_status"] = gr.Number(label="Interim Assessment Status", minimum=0, maximum=100)
49
- inputs["training_assessment_status"] = gr.Number(label="Training Assessment Status", minimum=0, maximum=100)
50
- inputs["mock_assessment_status"] = gr.Number(label="Mock Assessment Status", minimum=0, maximum=100)
51
-
52
-
53
- gr.Markdown("### Skill Rankings")
54
- with gr.Row():
55
- inputs["full_stack_rank"] = gr.Number(label="Full Stack Rank", minimum=0, maximum=1700)
56
- inputs["ps_rank"] = gr.Number(label="PS Level Completed", minimum=0, maximum=30)
57
- inputs["Overall_Skills_Acquired"] = gr.Number(label="Total Skills Acquired")
58
-
59
- gr.Markdown("### Extracurricular Activities")
60
- with gr.Row():
61
- for key in ["Technical_Competition", "Paper_Presentation", "Project_Competition", "Product_Development", "Patent", "Internship", "Online_Course"]:
62
- inputs[key] = gr.Number(label=key.replace("_", " ").title())
63
-
64
- submit = gr.Button("Predict Dropout")
65
-
66
- with gr.Column():
67
- gr.Markdown("### Prediction Output")
68
- output_plot = gr.Plot(label ="Dropout Risk Graph")
69
- summary = gr.Textbox(label = "Final Summary")
70
- download_btn = gr.File(label="Download Report",interactive=False)
71
-
72
-
73
- submit.click(
74
- lambda *args: process_and_generate_report(**dict(zip(inputs.keys(), args))),
75
- inputs=list(inputs.values()),
76
- outputs=[output_plot, summary, download_btn]
77
- )
78
-
79
- iface.launch()
 
1
+ import gradio as gr
2
+ from Backend import process_and_generate_report # Import backend functions
3
+
4
+ with gr.Blocks() as iface:
5
+ gr.Markdown("## <div style='text-align: center;'>AI-DRIVEN DROPOUT PREDICTION AND PREVENTION TOOL</div>")
6
+
7
+ with gr.Row():
8
+ with gr.Column():
9
+ inputs = {}
10
+
11
+ gr.Markdown("### Basic Information")
12
+ with gr.Row():
13
+ inputs["roll_no"] = gr.Textbox(label="Roll No", value="7376211CS203")
14
+ inputs["semester"] = gr.Dropdown(label="Semester", choices=["I", "II", "III", "IV", "V", "VI", "VII", "VIII"], value="VIII", interactive=True)
15
+
16
+ gr.Markdown("### Degree Information")
17
+ inputs["degree"] = gr.Dropdown(label="Degree", choices=[
18
+ "B.E. - ELECTRONICS AND INSTRUMENTATION ENGINEERING",
19
+ "B.E. - ELECTRONICS AND COMMUNICATION ENGINEERING",
20
+ "B.E. - ELECTRICAL AND ELECTRONICS ENGINEERING",
21
+ "B.E. - COMPUTER SCIENCE AND ENGINEERING",
22
+ "B.E. - MECHANICAL ENGINEERING",
23
+ "B.E. - MECHATRONICS ENGINEERING",
24
+ "B.Tech. - AGRICULTURAL ENGINEERING",
25
+ "B.Tech. - ARTIFICIAL INTELLIGENCE AND DATA SCIENCE",
26
+ "B.Tech. - ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING",
27
+ "B.Tech. - COMPUTER SCIENCE AND BUSINESS SYSTEMS",
28
+ "B.Tech. - INFORMATION TECHNOLOGY","B.Tech. - BIOTECHNOLOGY",
29
+ ], value="B.E. - COMPUTER SCIENCE AND ENGINEERING", interactive=True)
30
+
31
+ inputs["special_lab"] = gr.Dropdown(label="Special Lab", choices=["Active", "Non-Active"], value="Non-Active", interactive=True)
32
+
33
+ gr.Markdown("### Academic Performance")
34
+ with gr.Row():
35
+ inputs["attendance_percentage"] = gr.Number(label="Attendance Percentage", minimum=0, maximum=100, value=90)
36
+ inputs["formative_assessment"] = gr.Number(label="Formative Assessment (Academic %)", minimum=0, maximum=100, value=50)
37
+
38
+ with gr.Row():
39
+ inputs["cgpa"] = gr.Number(label="CGPA", minimum=0, maximum=10, value=8.0)
40
+ inputs["current_sgpa"] = gr.Number(label="Current SGPA", minimum=0, maximum=10, value=7.5)
41
+ inputs["arrear_count"] = gr.Number(label="Arrear Count", minimum=0, maximum=48, value=1)
42
+
43
+ gr.Markdown("### Placement and Assessments")
44
+ with gr.Row():
45
+ inputs["placement_fa"] = gr.Number(label="Placement FA %", minimum=0, maximum=100, value=50)
46
+ inputs["placement_cumulative"] = gr.Number(label="Placement Cumulative", minimum=0, maximum=100, value=60)
47
+ inputs["placement_Attendence"] = gr.Number(label="Placement Attendance", minimum=0, maximum=100, value=70)
48
+ inputs["interim_assessment_status"] = gr.Number(label="Interim Assessment Status", minimum=0, maximum=100, value=70)
49
+ inputs["training_assessment_status"] = gr.Number(label="Training Assessment Status", minimum=0, maximum=100, value=75)
50
+ inputs["mock_assessment_status"] = gr.Number(label="Mock Assessment Status", minimum=0, maximum=100, value=80)
51
+
52
+ gr.Markdown("### Skill Rankings")
53
+ with gr.Row():
54
+ inputs["full_stack_rank"] = gr.Number(label="Full Stack Rank", minimum=0, maximum=1700, value=850)
55
+ inputs["ps_rank"] = gr.Number(label="PS Level Completed", minimum=0, maximum=30, value=3)
56
+ inputs["Overall_Skills_Acquired"] = gr.Number(label="Total Skills Acquired", value=7)
57
+
58
+ gr.Markdown("### Extracurricular Activities")
59
+ with gr.Row():
60
+ for key in ["Technical_Competition", "Paper_Presentation", "Project_Competition", "Product_Development", "Patent", "Internship", "Online_Course"]:
61
+ inputs[key] = gr.Number(label=key.replace("_", " ").title(), value=0)
62
+
63
+ submit = gr.Button("Predict Dropout")
64
+
65
+ with gr.Column():
66
+ gr.Markdown("### Prediction Output")
67
+ output_plot = gr.Plot(label="Dropout Risk Graph")
68
+ summary = gr.Textbox(label="Final Summary")
69
+ download_btn = gr.File(label="Download Report", interactive=False)
70
+
71
+ submit.click(
72
+ lambda *args: process_and_generate_report(**dict(zip(inputs.keys(), args))),
73
+ inputs=list(inputs.values()),
74
+ outputs=[output_plot, summary, download_btn]
75
+ )
76
+
77
+ iface.launch()