Annikaijak commited on
Commit
6df78f5
1 Parent(s): 8d14cb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -10
app.py CHANGED
@@ -40,7 +40,7 @@ with tab1:
40
  col1, col2 = st.columns(2)
41
 
42
  with col1:
43
- st.markdown("**Parking place near building:**")
44
 
45
  # Function to load the building model
46
 
@@ -69,12 +69,14 @@ with tab1:
69
 
70
  building_most_recent_prediction = building_new[['x', 'y', 'z']]
71
  building_most_recent_prediction = building_hist_model.predict(building_most_recent_prediction)
72
- building_new['prediction'] = building_most_recent_prediction
73
- building_new = building_new.set_index(['time'])
74
- st.dataframe(building_new[['prediction']].tail(5))
 
 
75
 
76
  with col2:
77
- st.markdown("**Parking place near bikelane:**")
78
 
79
  # Function to load the bikelane model
80
  @st.cache_data()
@@ -134,7 +136,7 @@ with tab2:
134
  label = "No vehicle detected"
135
  return label
136
 
137
- st.markdown('**Experiment with building model:**')
138
  x_input_building = st.slider("Choose your x-value", -232, 909, 0)
139
  y_input_building = st.slider("Choose your y-value", -1112, 435, 0)
140
  z_input_building = st.slider("Choose your z-value", -1648, 226, 0)
@@ -145,7 +147,7 @@ with tab2:
145
 
146
  st.divider()
147
 
148
- st.markdown('**Experiment with bikelane model:**')
149
  x_input_bikelane = st.slider("Choose your x-value", -547, 288, 0)
150
  y_input_bikelane = st.slider("Choose your y-value", -1007, 786, 0)
151
  z_input_bikelane = st.slider("Choose your z-value", -1475, 16, 0)
@@ -155,6 +157,7 @@ with tab2:
155
  st.write(bikelane_input_prediction)
156
 
157
  with tab3:
 
158
  st.markdown('This application is made as part of the module "Data Engineering and Machine Learning Operations in Business - F2024" in Business Data Science 2nd Semester at Aalborg University Business School.')
159
  st.markdown('The application is made by Annika and Mikkel and is divided into 4 tabs:')
160
  st.markdown('* **Parking lot status:** The first tab includes the actual interface, where the goal has been to make a simple UI which shows if 3 parking spaces are occupied or available.')
@@ -184,16 +187,21 @@ with tab4:
184
  #st.dataframe(batch_data.head())
185
 
186
  with tab5:
187
- st.markdown('The predictions are made on the basis of two KNearestNeighbours models.')
188
 
189
- st.write('**Model to predict parking place near building:**')
 
190
  st.write(building_hist_model)
 
 
191
  st.image('building_hist_confusion_matrix.png', caption='Confusion matrix for building model')
192
 
193
  st.divider()
194
 
195
- st.write('**Model to predict parking place near bikelane:**')
 
196
  st.write(bikelane_hist_model)
 
 
197
  st.image('bikelane_hist_confusion_matrix.png', caption='Confusion matrix for bikelane model')
198
 
199
 
 
40
  col1, col2 = st.columns(2)
41
 
42
  with col1:
43
+ st.subheader("Parking place near building:")
44
 
45
  # Function to load the building model
46
 
 
69
 
70
  building_most_recent_prediction = building_new[['x', 'y', 'z']]
71
  building_most_recent_prediction = building_hist_model.predict(building_most_recent_prediction)
72
+ building_new['Status'] = building_most_recent_prediction
73
+ building_new['Status'].replace(['detection', 'no_detection'], ['Vehicle detected', 'No vehicle detected'], inplace=True)
74
+ building_new = building_new.rename(columns={'time': 'Time'})
75
+ building_new = building_new.set_index(['Time'])
76
+ st.dataframe(building_new[['Status']].tail(5))
77
 
78
  with col2:
79
+ st.subheader("Parking place near bikelane:")
80
 
81
  # Function to load the bikelane model
82
  @st.cache_data()
 
136
  label = "No vehicle detected"
137
  return label
138
 
139
+ st.subheader('Experiment with building model:')
140
  x_input_building = st.slider("Choose your x-value", -232, 909, 0)
141
  y_input_building = st.slider("Choose your y-value", -1112, 435, 0)
142
  z_input_building = st.slider("Choose your z-value", -1648, 226, 0)
 
147
 
148
  st.divider()
149
 
150
+ st.subheader('Experiment with bikelane model:')
151
  x_input_bikelane = st.slider("Choose your x-value", -547, 288, 0)
152
  y_input_bikelane = st.slider("Choose your y-value", -1007, 786, 0)
153
  z_input_bikelane = st.slider("Choose your z-value", -1475, 16, 0)
 
157
  st.write(bikelane_input_prediction)
158
 
159
  with tab3:
160
+ st.subheader('About the application:')
161
  st.markdown('This application is made as part of the module "Data Engineering and Machine Learning Operations in Business - F2024" in Business Data Science 2nd Semester at Aalborg University Business School.')
162
  st.markdown('The application is made by Annika and Mikkel and is divided into 4 tabs:')
163
  st.markdown('* **Parking lot status:** The first tab includes the actual interface, where the goal has been to make a simple UI which shows if 3 parking spaces are occupied or available.')
 
187
  #st.dataframe(batch_data.head())
188
 
189
  with tab5:
 
190
 
191
+ st.subheader('Model to predict parking place near building:')
192
+ st.markdown('The predictions for the parking place near the building are made on the basis of a KNearestNeighbours model')
193
  st.write(building_hist_model)
194
+ st.markdown('The accuracy if the bikelane model is 100%')
195
+ st.write('**Confusion matrix:**')
196
  st.image('building_hist_confusion_matrix.png', caption='Confusion matrix for building model')
197
 
198
  st.divider()
199
 
200
+ st.subheader('Model to predict parking place near bikelane:')
201
+ st.markdown('Just like with the other model, the predictions for the parking place near the bikelane are made on the basis of a KNearestNeighbours model')
202
  st.write(bikelane_hist_model)
203
+ st.markdown('The accuracy if the building model is 99%')
204
+ st.write('**Confusion matrix:**')
205
  st.image('bikelane_hist_confusion_matrix.png', caption='Confusion matrix for bikelane model')
206
 
207