Hemg commited on
Commit
b139652
·
verified ·
1 Parent(s): 4873d31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,4 +1,4 @@
1
- import gradio as gr
2
  import joblib
3
  import numpy as np
4
  import pandas as pd
@@ -30,19 +30,17 @@ def encode_categorical_columns(df):
30
  df = pd.get_dummies(df, columns=nominal_columns, drop_first=True)
31
 
32
  return df
33
-
34
- # Define the prediction function
35
  def predict_performance(Location, Course, College, Faculty, Source, Event, Presenter, Visited_Parent, Visited_College_for_Inquiry, Attended_Any_Event, College_Fee, GPA, Year):
36
-
37
-
38
  input_data = [Location, Course, College, Faculty, Source, Event, Presenter, Visited_Parent, Visited_College_for_Inquiry, Attended_Any_Event, College_Fee, GPA, Year]
39
 
 
40
  feature_names = [
41
  "Location", "Course", "College", "Faculty", "Source", "Event", "Presenter",
42
- "Visited Parent", "Visited College for Inquiry", "Attended Any Event", "College Fee", "GPA", "Year"
43
  ]
44
 
45
  input_df = pd.DataFrame([input_data], columns=feature_names)
 
46
 
47
  # Debug print 2: Show DataFrame before encoding
48
  print("\nDataFrame before encoding:")
 
1
+ mport gradio as gr
2
  import joblib
3
  import numpy as np
4
  import pandas as pd
 
30
  df = pd.get_dummies(df, columns=nominal_columns, drop_first=True)
31
 
32
  return df
 
 
33
  def predict_performance(Location, Course, College, Faculty, Source, Event, Presenter, Visited_Parent, Visited_College_for_Inquiry, Attended_Any_Event, College_Fee, GPA, Year):
 
 
34
  input_data = [Location, Course, College, Faculty, Source, Event, Presenter, Visited_Parent, Visited_College_for_Inquiry, Attended_Any_Event, College_Fee, GPA, Year]
35
 
36
+ # Updated feature names to use underscores instead of spaces
37
  feature_names = [
38
  "Location", "Course", "College", "Faculty", "Source", "Event", "Presenter",
39
+ "Visited_Parent", "Visited_College_for_Inquiry", "Attended_Any_Event", "College_Fee", "GPA", "Year"
40
  ]
41
 
42
  input_df = pd.DataFrame([input_data], columns=feature_names)
43
+
44
 
45
  # Debug print 2: Show DataFrame before encoding
46
  print("\nDataFrame before encoding:")