kerzel commited on
Commit
7b764b0
·
1 Parent(s): 13852e1

add example image

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import numpy as np
3
  import pandas as pd
 
4
 
5
  # our own helper tools
6
  import clustering
@@ -17,7 +18,7 @@ from tensorflow import keras
17
  # --- Constants and Model Loading ---
18
  IMAGE_PATH = "classified_damage_sites.png"
19
  CSV_PATH = "classified_damage_sites.csv"
20
-
21
 
22
  model1_windowsize = [250,250]
23
  #model1_threshold = 0.7
@@ -150,7 +151,9 @@ with gr.Blocks() as app:
150
  #image_input = gr.Image(value='data/X4-Aligned_cropped_upperleft_small.png', label='Example SEM Image (DP800 steel)',)
151
  with gr.Row():
152
  with gr.Column(scale=1):
153
- image_input = gr.Image(type="pil", label="Upload SEM Image")
 
 
154
  cluster_threshold_input = gr.Number(value=20, label="Image Binarization Threshold")
155
  model1_threshold_input = gr.Number(value=0.7, label="Inclusion Model Certainty (0-1)")
156
  model2_threshold_input = gr.Number(value=0.5, label="Damage Model Certainty (0-1)")
 
1
  import gradio as gr
2
  import numpy as np
3
  import pandas as pd
4
+ import os
5
 
6
  # our own helper tools
7
  import clustering
 
18
  # --- Constants and Model Loading ---
19
  IMAGE_PATH = "classified_damage_sites.png"
20
  CSV_PATH = "classified_damage_sites.csv"
21
+ DEFAULT_IMAGE_PATH = "X4-Aligned_cropped_upperleft_small.png"
22
 
23
  model1_windowsize = [250,250]
24
  #model1_threshold = 0.7
 
151
  #image_input = gr.Image(value='data/X4-Aligned_cropped_upperleft_small.png', label='Example SEM Image (DP800 steel)',)
152
  with gr.Row():
153
  with gr.Column(scale=1):
154
+ #image_input = gr.Image(type="pil", label="Upload SEM Image")
155
+ image_input = gr.Image(type="pil", label="Upload SEM Image",
156
+ value=DEFAULT_IMAGE_PATH if os.path.exists(DEFAULT_IMAGE_PATH) else None)
157
  cluster_threshold_input = gr.Number(value=20, label="Image Binarization Threshold")
158
  model1_threshold_input = gr.Number(value=0.7, label="Inclusion Model Certainty (0-1)")
159
  model2_threshold_input = gr.Number(value=0.5, label="Damage Model Certainty (0-1)")