Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
11 |
+
gdf1 = gpd.read_file(geojson1.name)
|
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
|
19 |
+
|
20 |
+
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=5.0, label="Numeric Value")
|
26 |
+
],
|
27 |
+
outputs=gr.outputs.Image(type="pil"),
|
28 |
+
title="Shadow Proximity",
|
29 |
+
description="Upload two GeoJSON files and select a numeric value to get the building proximity prediction.",
|
30 |
+
)
|
31 |
+
|
32 |
+
iface.launch()
|