leannebriffa commited on
Commit
1b1cb70
·
1 Parent(s): df9eb80

Fixed error in app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -96,24 +96,14 @@ def make_prediction(alcohol, arrest_type, belts, contributed_to_accident, disobe
96
  # Return the prediction
97
  return prediction[0]
98
 
99
- arrest_types = ['A - Marked Patrol', 'G - Marked Moving Radar (Stationary)',
100
- 'Q - Marked Laser', 'L - Motorcycle',
101
- 'H - Unmarked Moving Radar (Stationary)', 'O - Foot Patrol',
102
- 'E - Marked Stationary Radar', 'B - Unmarked Patrol',
103
- 'S - License Plate Recognition', 'R - Unmarked Laser',
104
- 'J - Unmarked Moving Radar (Moving)', 'M - Marked (Off-Duty)',
105
- 'I - Marked Moving Radar (Moving)',
106
- 'F - Unmarked Stationary Radar', 'D - Unmarked VASCAR',
107
- 'K - Aircraft Assist', 'C - Marked VASCAR', 'P - Mounted Patrol',
108
- 'N - Unmarked (Off-Duty)']
109
 
110
  iface = gr.Interface(fn=make_prediction,
111
  inputs=[gr.components.Checkbox(label='Was the driver under the influence of alcohol?'),
112
- gr.components.Dropdown(label='Choose the arrest type', choices=arrest_types, value='A - Marked Patrol'),
113
  gr.components.Checkbox(label='Were seatbelts used appropriately?'),
114
  gr.components.Checkbox(label='Did the driver actions contribute to an accident?'),
115
  gr.components.Checkbox(label='Was the driver disobedient? (such as failing to display documentation upon request)?'),
116
- gr.components.Dropdown(label='Choose the arrest type', choices=tf['OrdinalEncoder_VeryHighCardinality'].categories_, value='SILVER SPRING'),
117
  gr.components.Dropdown(label='Driver Gender', choices=['M', 'F', 'N'], value='M'),
118
  gr.components.Checkbox(label='Was the driver driving with Invalid Documentation (such as suspended registration, suspended license, expired registration plates and validation tabs or expired license plate)?'),
119
  gr.components.Dropdown(label='Vehicle Make', choices=tf['OrdinalEncoder_HighCardinality'].categories_[0], value='TOYOTA'),
 
96
  # Return the prediction
97
  return prediction[0]
98
 
 
 
 
 
 
 
 
 
 
 
99
 
100
  iface = gr.Interface(fn=make_prediction,
101
  inputs=[gr.components.Checkbox(label='Was the driver under the influence of alcohol?'),
102
+ gr.components.Dropdown(label='Choose the arrest type', choices=tf['OneHotEncoder'].transformers_[0][1].categories_[0], value='A - Marked Patrol'),
103
  gr.components.Checkbox(label='Were seatbelts used appropriately?'),
104
  gr.components.Checkbox(label='Did the driver actions contribute to an accident?'),
105
  gr.components.Checkbox(label='Was the driver disobedient? (such as failing to display documentation upon request)?'),
106
+ gr.components.Dropdown(label='Choose the driver city', choices=tf['OrdinalEncoder_VeryHighCardinality'].categories_[0], value='SILVER SPRING'),
107
  gr.components.Dropdown(label='Driver Gender', choices=['M', 'F', 'N'], value='M'),
108
  gr.components.Checkbox(label='Was the driver driving with Invalid Documentation (such as suspended registration, suspended license, expired registration plates and validation tabs or expired license plate)?'),
109
  gr.components.Dropdown(label='Vehicle Make', choices=tf['OrdinalEncoder_HighCardinality'].categories_[0], value='TOYOTA'),