Isabel Gwara commited on
Commit
8f299bb
·
1 Parent(s): bf8a587

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -102,15 +102,15 @@ y_pred = model.predict(x_test)
102
 
103
 
104
  # predictor for generic number of features
105
- def general_predictor(*args):
106
  features = []
107
 
108
  # transform categorical input
109
- for colname, arg in zip(data.columns, args):
110
  if (colname in cat_value_dicts):
111
- features.append(cat_value_dicts[colname][arg])
112
  else:
113
- features.append(arg)
114
 
115
  # predict single datapoint
116
  new_input = [features]
@@ -135,7 +135,6 @@ for colname in data.columns:
135
 
136
  # generate gradio interface
137
  if st.button("Submit"):
138
- x = pd.DataFrame([inputls])
139
- prediction = model.predict(x)[0]
140
 
141
  st.text(f"This instance is a {prediction}")
 
102
 
103
 
104
  # predictor for generic number of features
105
+ def general_predictor(input_list):
106
  features = []
107
 
108
  # transform categorical input
109
+ for colname, input in zip(data.columns, input_list):
110
  if (colname in cat_value_dicts):
111
+ features.append(cat_value_dicts[colname][input])
112
  else:
113
+ features.append(input)
114
 
115
  # predict single datapoint
116
  new_input = [features]
 
135
 
136
  # generate gradio interface
137
  if st.button("Submit"):
138
+ prediction = general_predictor(inputls)
 
139
 
140
  st.text(f"This instance is a {prediction}")