Annikaijak commited on
Commit
29b8c4f
1 Parent(s): f927bb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -8
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
 
@@ -74,7 +74,7 @@ with tab1:
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()
@@ -124,21 +124,34 @@ with tab1:
124
  st.experimental_rerun()
125
 
126
  with tab2:
127
- st.markdown('Experiment with building model')
128
- x_input_building = st.slider("Choose your x-value", -232, 909, 0)
129
- y_input_building = st.slider("Choose your y-value", -1112, 435, 0)
130
- z_input_building = st.slider("Choose your z-value", -1648, 226, 0)
131
-
132
  def explore_magnetic_field(model, x, y, z):
133
  input_list = [x, y, z]
134
  res = model.predict(np.asarray(input_list).reshape(1,-1))
135
  explorer_prediction = res[0]
136
- return explorer_prediction
 
 
 
 
 
 
 
 
 
137
 
138
  if st.button("Predict"):
139
  building_input_prediction = explore_magnetic_field(building_hist_model, x_input_building, y_input_building, z_input_building)
140
  st.write(building_input_prediction)
141
 
 
 
 
 
 
 
 
 
 
142
  with tab3:
143
  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.')
144
  st.markdown('The application is made by Annika and Mikkel and is divided into 4 tabs:')
 
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
 
 
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()
 
124
  st.experimental_rerun()
125
 
126
  with tab2:
 
 
 
 
 
127
  def explore_magnetic_field(model, x, y, z):
128
  input_list = [x, y, z]
129
  res = model.predict(np.asarray(input_list).reshape(1,-1))
130
  explorer_prediction = res[0]
131
+ if explorer_prediction == 'detection':
132
+ label = "Vehicle detected"
133
+ else:
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)
141
 
142
  if st.button("Predict"):
143
  building_input_prediction = explore_magnetic_field(building_hist_model, x_input_building, y_input_building, z_input_building)
144
  st.write(building_input_prediction)
145
 
146
+ st.markdown('**Experiment with bikelane model:**')
147
+ x_input_bikelane = st.slider("Choose your x-value", -547, 288, 0)
148
+ y_input_bikelane = st.slider("Choose your y-value", -1007, 786, 0)
149
+ z_input_bikelane = st.slider("Choose your z-value", -1475, 16, 0)
150
+
151
+ if st.button("Predict"):
152
+ bikelane_input_prediction = explore_magnetic_field(bikelane_hist_model, x_input_bikelane, y_input_bikelane, z_input_bikelane)
153
+ st.write(bikelane_input_prediction)
154
+
155
  with tab3:
156
  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.')
157
  st.markdown('The application is made by Annika and Mikkel and is divided into 4 tabs:')