Commit
·
2a2910d
1
Parent(s):
637a738
model was corrupted
Browse files- .gitignore +4 -1
- app.py +16 -4
- assets/data/croppe.png +0 -3
- assets/models/localization.onnx +2 -2
- requirements.txt +2 -1
.gitignore
CHANGED
|
@@ -64,4 +64,7 @@ venv.bak/
|
|
| 64 |
.vscode/
|
| 65 |
|
| 66 |
# tmp folder
|
| 67 |
-
.tmp
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
.vscode/
|
| 65 |
|
| 66 |
# tmp folder
|
| 67 |
+
.tmp
|
| 68 |
+
|
| 69 |
+
# gradio folder
|
| 70 |
+
.gradio
|
app.py
CHANGED
|
@@ -366,6 +366,8 @@ class LocalizationModel:
|
|
| 366 |
|
| 367 |
|
| 368 |
def infer(image1, image2):
|
|
|
|
|
|
|
| 369 |
localization_model = LocalizationModel()
|
| 370 |
change_detection_model = ChangeDetectionModel()
|
| 371 |
# resize image1 to image2
|
|
@@ -410,6 +412,11 @@ sample_images = [
|
|
| 410 |
["assets/data/beirut_1_pre.png", "assets/data/beirut_1_post.png"]
|
| 411 |
]
|
| 412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
with gr.Blocks() as demo:
|
| 414 |
gr.Markdown("## Infrastructure Damage Assessment")
|
| 415 |
# description
|
|
@@ -437,9 +444,14 @@ with gr.Blocks() as demo:
|
|
| 437 |
output_image1 = gr.Image(label="Roads and buildings localization", type="pil")
|
| 438 |
output_image2 = gr.Image(label="Change detection", type="pil")
|
| 439 |
submit_button = gr.Button("Run Inference")
|
| 440 |
-
examples = gr.Examples(
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
|
| 445 |
demo.launch()
|
|
|
|
| 366 |
|
| 367 |
|
| 368 |
def infer(image1, image2):
|
| 369 |
+
assert isinstance(image1, Image.Image), "image1 is not a PIL Image"
|
| 370 |
+
assert isinstance(image2, Image.Image), "image2 is not a PIL Image"
|
| 371 |
localization_model = LocalizationModel()
|
| 372 |
change_detection_model = ChangeDetectionModel()
|
| 373 |
# resize image1 to image2
|
|
|
|
| 412 |
["assets/data/beirut_1_pre.png", "assets/data/beirut_1_post.png"]
|
| 413 |
]
|
| 414 |
|
| 415 |
+
# Check if all files exist
|
| 416 |
+
for pair in sample_images:
|
| 417 |
+
for file in pair:
|
| 418 |
+
assert os.path.exists(file), f"File not found: {file}"
|
| 419 |
+
|
| 420 |
with gr.Blocks() as demo:
|
| 421 |
gr.Markdown("## Infrastructure Damage Assessment")
|
| 422 |
# description
|
|
|
|
| 444 |
output_image1 = gr.Image(label="Roads and buildings localization", type="pil")
|
| 445 |
output_image2 = gr.Image(label="Change detection", type="pil")
|
| 446 |
submit_button = gr.Button("Run Inference")
|
| 447 |
+
examples = gr.Examples(
|
| 448 |
+
examples=sample_images,
|
| 449 |
+
inputs=[input_image1, input_image2]
|
| 450 |
+
)
|
| 451 |
+
submit_button.click(
|
| 452 |
+
infer,
|
| 453 |
+
inputs=[input_image1, input_image2],
|
| 454 |
+
outputs=[output_image1, output_image2],
|
| 455 |
+
)
|
| 456 |
|
| 457 |
demo.launch()
|
assets/data/croppe.png
DELETED
Git LFS Details
|
assets/models/localization.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4fccf7582ce357e67b6f16be6c969a394a47fb11a62a311c99fa0fd7e529af1c
|
| 3 |
+
size 361226794
|
requirements.txt
CHANGED
|
@@ -4,4 +4,5 @@ onnxruntime==1.21.0
|
|
| 4 |
pandas==2.2.3
|
| 5 |
pillow==11.1.0
|
| 6 |
scipy==1.15.2
|
| 7 |
-
tqdm==4.67.1
|
|
|
|
|
|
| 4 |
pandas==2.2.3
|
| 5 |
pillow==11.1.0
|
| 6 |
scipy==1.15.2
|
| 7 |
+
tqdm==4.67.1
|
| 8 |
+
pydantic==2.10.6
|