Commit
·
9aff8dd
1
Parent(s):
47155cb
app.py fix
Browse files
app.py
CHANGED
@@ -94,6 +94,12 @@ def make_prediction(alcohol, arrest_type, belts, contributed_to_accident, disobe
|
|
94 |
prediction = tf["LabelEncoder"].inverse_transform(np.argmax(prediction, axis=1))
|
95 |
|
96 |
# Return the prediction
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
return prediction[0]
|
98 |
|
99 |
|
@@ -114,12 +120,13 @@ iface = gr.Interface(fn=make_prediction,
|
|
114 |
gr.components.Checkbox(label='Did the violation involve any property damage?'),
|
115 |
gr.components.Dropdown(label='Choose the race of the driver', choices=list(tf['OneHotEncoder'].transformers_[0][1].categories_[2]), value='WHITE'),
|
116 |
gr.components.Checkbox(label='Did the driver fail to obey signs and markings (such as traffic control device instructions, stop lights, red signal and stop sign lines)?'),
|
117 |
-
gr.components.Dropdown(label='
|
118 |
gr.components.Checkbox(label='Was the driver caught speeding?'),
|
119 |
gr.components.Slider(maximum=23, step=1, label='Time HOUR when stop occurred in 24-hour format'),
|
120 |
gr.components.Slider(minimum=2012, maximum=2024, step=1, label='Year when stop occurred'),
|
121 |
gr.components.Dropdown(label='What is the name of the subagency that conducted the traffic stop?', choices=list(tf['OneHotEncoder'].transformers_[0][1].categories_[1]), value='4th District, Wheaton'),
|
122 |
gr.components.Checkbox(label='Was the vehicle safe and up to standards (lights properly switched, registration plates attached etc.)?'),
|
|
|
123 |
gr.components.Slider(minimum=1970, maximum=2023, step=1, label='Year of manufacture of the vehicle:')],
|
124 |
outputs=["text"])
|
125 |
|
|
|
94 |
prediction = tf["LabelEncoder"].inverse_transform(np.argmax(prediction, axis=1))
|
95 |
|
96 |
# Return the prediction
|
97 |
+
# if prediction[0] == 0:
|
98 |
+
# return 'SERO'
|
99 |
+
# elif prediction[0] == 1:
|
100 |
+
# return 'Warning'
|
101 |
+
# else:
|
102 |
+
# return 'Citation'
|
103 |
return prediction[0]
|
104 |
|
105 |
|
|
|
120 |
gr.components.Checkbox(label='Did the violation involve any property damage?'),
|
121 |
gr.components.Dropdown(label='Choose the race of the driver', choices=list(tf['OneHotEncoder'].transformers_[0][1].categories_[2]), value='WHITE'),
|
122 |
gr.components.Checkbox(label='Did the driver fail to obey signs and markings (such as traffic control device instructions, stop lights, red signal and stop sign lines)?'),
|
123 |
+
gr.components.Dropdown(label='What was the outcome of the search (if conducted)?', choices=list(tf['OneHotEncoder'].transformers_[0][1].categories_[3]), value='NO SEARCH CONDUCTED'),
|
124 |
gr.components.Checkbox(label='Was the driver caught speeding?'),
|
125 |
gr.components.Slider(maximum=23, step=1, label='Time HOUR when stop occurred in 24-hour format'),
|
126 |
gr.components.Slider(minimum=2012, maximum=2024, step=1, label='Year when stop occurred'),
|
127 |
gr.components.Dropdown(label='What is the name of the subagency that conducted the traffic stop?', choices=list(tf['OneHotEncoder'].transformers_[0][1].categories_[1]), value='4th District, Wheaton'),
|
128 |
gr.components.Checkbox(label='Was the vehicle safe and up to standards (lights properly switched, registration plates attached etc.)?'),
|
129 |
+
gr.components.Dropdown(label='What is the vehicle type?', choices=list(tf['OrdinalEncoder_HighCardinality'].categories_[1]), value='02 - Automobile'),
|
130 |
gr.components.Slider(minimum=1970, maximum=2023, step=1, label='Year of manufacture of the vehicle:')],
|
131 |
outputs=["text"])
|
132 |
|