Spaces:
Sleeping
Sleeping
Update new_app.py
Browse files- new_app.py +19 -29
new_app.py
CHANGED
|
@@ -53,20 +53,26 @@ col1, col2 = st.columns(2)
|
|
| 53 |
with col1:
|
| 54 |
_, col = st.columns(2)
|
| 55 |
with col:
|
| 56 |
-
st.header('Overpass Detector')
|
| 57 |
st.markdown(
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
with col2:
|
| 71 |
_, col, _ = st.columns(3)
|
| 72 |
with col:
|
|
@@ -149,22 +155,6 @@ with col1:
|
|
| 149 |
with st.spinner("Running inference..."):
|
| 150 |
result = state.loaded_model.predict(img_array)
|
| 151 |
crossing_chance = result[0][1]*100
|
| 152 |
-
status = None
|
| 153 |
-
if crossing_chance >= 90:
|
| 154 |
-
status = "extremely likely"
|
| 155 |
-
elif crossing_chance >= 60:
|
| 156 |
-
status = "likely"
|
| 157 |
-
elif crossing_chance >= 40:
|
| 158 |
-
status = "a coin toss whether"
|
| 159 |
-
elif crossing_chance >= 10:
|
| 160 |
-
status = "unlikely"
|
| 161 |
-
elif crossing_chance >= 0:
|
| 162 |
-
status = "extremely unlikely"
|
| 163 |
-
|
| 164 |
-
st.write(f"It's {status} there's an overpass here.")
|
| 165 |
-
st.write("")
|
| 166 |
-
st.write(f"In fact, the likelihood of at least one overpass is {np.round(crossing_chance,decimals=2)}%.")
|
| 167 |
-
|
| 168 |
pct = np.round(crossing_chance,decimals=2)
|
| 169 |
|
| 170 |
label = "Overpass Likely" if pct >= 50 else "Overpass Unlikely"
|
|
|
|
| 53 |
with col1:
|
| 54 |
_, col = st.columns(2)
|
| 55 |
with col:
|
|
|
|
| 56 |
st.markdown(
|
| 57 |
+
"<h1 style='text-align: center; margin-bottom: 0.1em;'>Overpass Detector</h1>",
|
| 58 |
+
unsafe_allow_html=True
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
st.markdown(
|
| 62 |
+
"""
|
| 63 |
+
<div style="
|
| 64 |
+
text-align:center;
|
| 65 |
+
font-size:1.25rem;
|
| 66 |
+
margin-top:-0.3rem;
|
| 67 |
+
margin-bottom:0.6rem;
|
| 68 |
+
opacity:0.9;
|
| 69 |
+
">
|
| 70 |
+
This page runs a trained machine learning model to detect road overpasses in satellite imagery.
|
| 71 |
+
</div>
|
| 72 |
+
""",
|
| 73 |
+
unsafe_allow_html=True
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
with col2:
|
| 77 |
_, col, _ = st.columns(3)
|
| 78 |
with col:
|
|
|
|
| 155 |
with st.spinner("Running inference..."):
|
| 156 |
result = state.loaded_model.predict(img_array)
|
| 157 |
crossing_chance = result[0][1]*100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
pct = np.round(crossing_chance,decimals=2)
|
| 159 |
|
| 160 |
label = "Overpass Likely" if pct >= 50 else "Overpass Unlikely"
|