Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,68 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from autogluon.tabular import TabularPredictor
|
| 3 |
+
from huggingface_hub import snapshot_download
|
| 4 |
+
import pandas as pd
|
| 5 |
|
| 6 |
+
model_dir = snapshot_download(repo_id="DeltaSatellite1/grade_prediction")
|
| 7 |
+
predictor = TabularPredictor.load(model_dir)
|
| 8 |
|
| 9 |
+
def grade_predict(gpa,t_gpa,cls_grade,a_date,due_date,field,field_avg,category,category_w,category_avg,dha,dbd,diff,field_prof,teacher_exp,wdp,incentive,confidence,attendence,participation,procrastination):
|
| 10 |
+
|
| 11 |
+
df = pd.DataFrame([{
|
| 12 |
+
"weighted gpa":gpa,
|
| 13 |
+
"term gpa":t_gpa,
|
| 14 |
+
"class grade":cls_grade,
|
| 15 |
+
"assigned date":a_date,
|
| 16 |
+
"due date":due_date,
|
| 17 |
+
"field":field,
|
| 18 |
+
"field average (%)":field_avg,
|
| 19 |
+
"category":category,
|
| 20 |
+
"category weight":category_w,
|
| 21 |
+
"category average":category_avg,
|
| 22 |
+
"daily hours available":dha,
|
| 23 |
+
"days before due":dbd,
|
| 24 |
+
"difficulty":diff,
|
| 25 |
+
"field proficiency":field_prof,
|
| 26 |
+
"teacher experience": teacher_exp,
|
| 27 |
+
"work day positivity": wdp,
|
| 28 |
+
"incentive":incentive,
|
| 29 |
+
"confidence":confidence
|
| 30 |
+
"attendence":attendence,
|
| 31 |
+
"participation":participation,
|
| 32 |
+
"procrastination": procrastination
|
| 33 |
+
}])
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
return predictor.predict(df)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
demo = gr.Interface(
|
| 40 |
+
title="Grade Prediction Model",
|
| 41 |
+
description="idk",
|
| 42 |
+
fn=grade_predict,
|
| 43 |
+
inputs=[
|
| 44 |
+
gr.Number(label="Weighted GPA"),
|
| 45 |
+
gr.Number(label="Term GPA"),
|
| 46 |
+
gr.Number(label="Class grade"),
|
| 47 |
+
gr.DateTime(label="Assigned date", include_time=True),
|
| 48 |
+
gr.DateTime(label="Due date", include_time=True),
|
| 49 |
+
gr.Textbox(label="Field"),
|
| 50 |
+
gr.Number(label="Field Average(%)"),
|
| 51 |
+
gr.Textbox(label="Category"),
|
| 52 |
+
gr.Number(label="Category weight"),
|
| 53 |
+
gr.Number(label="Category average"),
|
| 54 |
+
gr.Number(label="Daily hours available"),
|
| 55 |
+
gr.Number(label="Days before due"),
|
| 56 |
+
gr.Textbox(label="Difficulty"),
|
| 57 |
+
gr.Textbox(label="Field proficiency"),
|
| 58 |
+
gr.Textbox(label="Teacher experience"),
|
| 59 |
+
gr.Textbox(label="Work-day positivity"),
|
| 60 |
+
gr.Textbox(label="Incentive"),
|
| 61 |
+
gr.Textbox(label="Confidence"),
|
| 62 |
+
gr.Textbox(label="Attendence"),
|
| 63 |
+
gr.Textbox(label="Participation"),
|
| 64 |
+
gr.Textbox(label="Procrastination"),
|
| 65 |
+
|
| 66 |
+
],
|
| 67 |
+
outputs="Score")
|
| 68 |
demo.launch()
|