github-actions[bot] commited on
Commit
332b309
·
1 Parent(s): 66979e3

Sync with https://github.com/mozilla-ai/osm-ai-helper

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -59,7 +59,7 @@ def inference(lat_lon, margin):
59
  margin=margin,
60
  )
61
  st.text(f"Found: {len(new)} new polygons")
62
- return output_path, new
63
 
64
 
65
  @st.fragment
@@ -119,9 +119,20 @@ def upload_results(output_path):
119
 
120
  st.title("OpenStreetMap AI Helper")
121
 
 
 
 
 
 
 
 
 
 
122
  st.divider()
123
 
124
- st.subheader("Click on the map to select a latitude and longitude")
 
 
125
 
126
  show_map()
127
 
@@ -129,18 +140,20 @@ lat_lon = st.text_input("Paste the copied (latitude, longitude)")
129
 
130
  if st.button("Run Inference") and lat_lon:
131
  lat, lon = lat_lon.split(",")
132
- output_path, new = inference(
133
  lat_lon=(float(lat.strip()), float(lon.strip())), margin=2
134
  )
135
 
 
 
136
  if new:
137
  st.divider()
138
- st.header("Review `new` polygons")
139
  st.markdown(
140
- "Every `new` polygon will be displayed at the center of the image in `yellow`."
141
  )
142
  st.markdown(
143
- "Polygons in other colors are those already existing in OpenStreetMap and they just "
144
  "indicate whether the model has found them (`green`) or missed them (`red`)."
145
  )
146
  for new in Path(output_path).glob("*.json"):
@@ -148,4 +161,4 @@ if st.button("Run Inference") and lat_lon:
148
 
149
  upload_results(output_path)
150
  else:
151
- st.warning("No `new` polygons were found. Try a different location.")
 
59
  margin=margin,
60
  )
61
  st.text(f"Found: {len(new)} new polygons")
62
+ return output_path, existing, new
63
 
64
 
65
  @st.fragment
 
119
 
120
  st.title("OpenStreetMap AI Helper")
121
 
122
+ st.markdown(
123
+ """
124
+ This demo uses [mozilla-ai/swimming-pool-detector](https://huggingface.co/mozilla-ai/swimming-pool-detector).
125
+
126
+ You can check the [Create Dataset](https://colab.research.google.com/github/mozilla-ai//osm-ai-helper/blob/main/demo/create_dataset.ipyn)
127
+ and [Finetune Model](https://colab.research.google.com/github/mozilla-ai//osm-ai-helper/blob/main/demo/finetune_model.ipynb) notebooks to learn how to train your own model.
128
+ """
129
+ )
130
+
131
  st.divider()
132
 
133
+ st.subheader(
134
+ "Click on the map to select a latitude and longitude. The model will try to find swimming pools around this location."
135
+ )
136
 
137
  show_map()
138
 
 
140
 
141
  if st.button("Run Inference") and lat_lon:
142
  lat, lon = lat_lon.split(",")
143
+ output_path, existing, new = inference(
144
  lat_lon=(float(lat.strip()), float(lon.strip())), margin=2
145
  )
146
 
147
+ st.info(f"Found {len(existing)} swimming pools already in OpenStreetMaps.")
148
+
149
  if new:
150
  st.divider()
151
+ st.header("Review `new` swimming pools")
152
  st.markdown(
153
+ "Every `new` swimming pool will be displayed at the center of the image in `yellow`."
154
  )
155
  st.markdown(
156
+ "Swimming pools in other colors are those already existing in OpenStreetMap and they just "
157
  "indicate whether the model has found them (`green`) or missed them (`red`)."
158
  )
159
  for new in Path(output_path).glob("*.json"):
 
161
 
162
  upload_results(output_path)
163
  else:
164
+ st.warning("No `new` swimming pools were found. Try a different location.")