Spaces:
Sleeping
Sleeping
github-actions[bot]
commited on
Commit
·
cd52496
1
Parent(s):
0bf3aee
Sync with https://github.com/mozilla-ai/osm-ai-helper
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ def show_map():
|
|
43 |
|
44 |
|
45 |
@st.fragment
|
46 |
-
def inference(lat_lon
|
47 |
with st.spinner("Downloading model..."):
|
48 |
hf_hub_download(
|
49 |
"mozilla-ai/swimming-pool-detector",
|
@@ -56,8 +56,9 @@ def inference(lat_lon, margin):
|
|
56 |
yolo_model_file="models/model.pt",
|
57 |
output_dir="/tmp/results",
|
58 |
lat_lon=lat_lon,
|
59 |
-
margin=
|
60 |
save_full_images=False,
|
|
|
61 |
)
|
62 |
return output_path, existing, new
|
63 |
|
@@ -97,7 +98,7 @@ def upload_results(output_path):
|
|
97 |
"The results will be uploaded using the [osm-ai-helper](https://www.openstreetmap.org/user/osm-ai-helper) profile."
|
98 |
)
|
99 |
st.markdown(
|
100 |
-
"You can check the [Colab Notebook](ttps://colab.research.google.com/github/mozilla-ai/osm-ai-helper/blob/main/demo/
|
101 |
" and the [Authorization Guide](https://mozilla-ai.github.io/osm-ai-helper/authorization)"
|
102 |
" to contribute with your own OpenStreetMap account."
|
103 |
)
|
@@ -152,7 +153,7 @@ lat_lon = st.text_input("Paste the copied (latitude, longitude)")
|
|
152 |
if st.button("Run Inference") and lat_lon:
|
153 |
lat, lon = lat_lon.split(",")
|
154 |
output_path, existing, new = inference(
|
155 |
-
lat_lon=(float(lat.strip()), float(lon.strip()))
|
156 |
)
|
157 |
|
158 |
st.info(f"Found {len(existing)} swimming pools already in OpenStreetMaps.")
|
|
|
43 |
|
44 |
|
45 |
@st.fragment
|
46 |
+
def inference(lat_lon):
|
47 |
with st.spinner("Downloading model..."):
|
48 |
hf_hub_download(
|
49 |
"mozilla-ai/swimming-pool-detector",
|
|
|
56 |
yolo_model_file="models/model.pt",
|
57 |
output_dir="/tmp/results",
|
58 |
lat_lon=lat_lon,
|
59 |
+
margin=2,
|
60 |
save_full_images=False,
|
61 |
+
batch_size=64,
|
62 |
)
|
63 |
return output_path, existing, new
|
64 |
|
|
|
98 |
"The results will be uploaded using the [osm-ai-helper](https://www.openstreetmap.org/user/osm-ai-helper) profile."
|
99 |
)
|
100 |
st.markdown(
|
101 |
+
"You can check the [Colab Notebook](ttps://colab.research.google.com/github/mozilla-ai/osm-ai-helper/blob/main/demo/run_inference_point.ipynb)"
|
102 |
" and the [Authorization Guide](https://mozilla-ai.github.io/osm-ai-helper/authorization)"
|
103 |
" to contribute with your own OpenStreetMap account."
|
104 |
)
|
|
|
153 |
if st.button("Run Inference") and lat_lon:
|
154 |
lat, lon = lat_lon.split(",")
|
155 |
output_path, existing, new = inference(
|
156 |
+
lat_lon=(float(lat.strip()), float(lon.strip()))
|
157 |
)
|
158 |
|
159 |
st.info(f"Found {len(existing)} swimming pools already in OpenStreetMaps.")
|