Spaces:
Runtime error
Runtime error
Suchinthana
commited on
Commit
Β·
6ad0561
1
Parent(s):
b1e7b22
Update app.py
Browse files
app.py
CHANGED
|
@@ -110,7 +110,7 @@ def generate_geojson(response):
|
|
| 110 |
@spaces.GPU
|
| 111 |
def generate_static_map(geojson_data):
|
| 112 |
# Create a static map object with specified dimensions
|
| 113 |
-
m = StaticMap(
|
| 114 |
|
| 115 |
# Process each feature in the GeoJSON
|
| 116 |
for feature in geojson_data["features"]:
|
|
@@ -123,11 +123,11 @@ def generate_static_map(geojson_data):
|
|
| 123 |
elif geom_type in ["MultiPoint", "LineString"]:
|
| 124 |
# Add a red marker for each point in MultiPoint or LineString geometries
|
| 125 |
for coord in coords:
|
| 126 |
-
m.add_marker(CircleMarker((coord[0], coord[1]), '
|
| 127 |
elif geom_type in ["Polygon", "MultiPolygon"]:
|
| 128 |
# Add green polygons for Polygon or MultiPolygon geometries
|
| 129 |
for polygon in coords:
|
| 130 |
-
m.add_polygon(Polygon([(c[0], c[1]) for c in polygon], '
|
| 131 |
|
| 132 |
# Render the static map and return the Pillow Image object
|
| 133 |
return m.render(zoom=10)
|
|
@@ -159,8 +159,8 @@ def generate_satellite_image(init_image, mask_image, prompt):
|
|
| 159 |
image=init_image,
|
| 160 |
mask_image=mask_image,
|
| 161 |
control_image=control_image,
|
| 162 |
-
strength=0.
|
| 163 |
-
guidance_scale=
|
| 164 |
)
|
| 165 |
return result.images[0]
|
| 166 |
|
|
|
|
| 110 |
@spaces.GPU
|
| 111 |
def generate_static_map(geojson_data):
|
| 112 |
# Create a static map object with specified dimensions
|
| 113 |
+
m = StaticMap(1000, 1000)
|
| 114 |
|
| 115 |
# Process each feature in the GeoJSON
|
| 116 |
for feature in geojson_data["features"]:
|
|
|
|
| 123 |
elif geom_type in ["MultiPoint", "LineString"]:
|
| 124 |
# Add a red marker for each point in MultiPoint or LineString geometries
|
| 125 |
for coord in coords:
|
| 126 |
+
m.add_marker(CircleMarker((coord[0], coord[1]), 'blue', 10))
|
| 127 |
elif geom_type in ["Polygon", "MultiPolygon"]:
|
| 128 |
# Add green polygons for Polygon or MultiPolygon geometries
|
| 129 |
for polygon in coords:
|
| 130 |
+
m.add_polygon(Polygon([(c[0], c[1]) for c in polygon], 'blue', 3))
|
| 131 |
|
| 132 |
# Render the static map and return the Pillow Image object
|
| 133 |
return m.render(zoom=10)
|
|
|
|
| 159 |
image=init_image,
|
| 160 |
mask_image=mask_image,
|
| 161 |
control_image=control_image,
|
| 162 |
+
strength=0.45,
|
| 163 |
+
guidance_scale=62
|
| 164 |
)
|
| 165 |
return result.images[0]
|
| 166 |
|