Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import geopandas as gpd
|
3 |
from shapely.geometry import shape
|
4 |
-
from your_model_module import AutoEIABuildingProximity # Import your model here
|
5 |
-
|
6 |
-
# Initialize your model
|
7 |
-
model = AutoEIABuildingProximity()
|
8 |
|
9 |
def predict(geojson1, geojson2, value):
|
10 |
# Read the GeoJSON files
|
@@ -12,7 +8,7 @@ def predict(geojson1, geojson2, value):
|
|
12 |
gdf2 = gpd.read_file(geojson2.name)
|
13 |
|
14 |
# Use the model to make a prediction
|
15 |
-
output_image = model.predict(gdf1, gdf2, value)
|
16 |
|
17 |
# Return the image
|
18 |
return output_image
|
@@ -21,12 +17,13 @@ iface = gr.Interface(
|
|
21 |
fn=predict,
|
22 |
inputs=[
|
23 |
gr.inputs.File(label="GeoJSON Input 1"),
|
24 |
-
gr.inputs.File(label="GeoJSON Input 2"),
|
25 |
-
gr.inputs.Slider(minimum=0.0, maximum=10.0, default=
|
|
|
26 |
],
|
27 |
outputs=gr.outputs.Image(type="pil"),
|
28 |
title="Shadow Proximity",
|
29 |
-
description="Upload
|
30 |
)
|
31 |
|
32 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import geopandas as gpd
|
3 |
from shapely.geometry import shape
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def predict(geojson1, geojson2, value):
|
6 |
# Read the GeoJSON files
|
|
|
8 |
gdf2 = gpd.read_file(geojson2.name)
|
9 |
|
10 |
# Use the model to make a prediction
|
11 |
+
#output_image = model.predict(gdf1, gdf2, value)
|
12 |
|
13 |
# Return the image
|
14 |
return output_image
|
|
|
17 |
fn=predict,
|
18 |
inputs=[
|
19 |
gr.inputs.File(label="GeoJSON Input 1"),
|
20 |
+
gr.inputs.File(label="GeoJSON Input 2"), #This should be optional
|
21 |
+
gr.inputs.Slider(minimum=0.0, maximum=10.0, default=4.3, label="Building Height Multiplier"),
|
22 |
+
gr.inputs.Number(default=200, label="Default Building Height"), #Can I make this optional?
|
23 |
],
|
24 |
outputs=gr.outputs.Image(type="pil"),
|
25 |
title="Shadow Proximity",
|
26 |
+
description="Upload proposed building footprints in a GeoJSON file and select a numeric value to get the building proximity prediction.",
|
27 |
)
|
28 |
|
29 |
iface.launch()
|