AveMujica commited on
Commit
ea18dcf
·
verified ·
1 Parent(s): 5a6442a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -305,8 +305,9 @@ def process_with_alignment(location, reference_image, input_image):
305
 
306
  # Create the Gradio interface
307
  def create_interface():
308
- scale = 0.5
309
- disp_w, disp_h = int(1365*scale), int(1024*scale)
 
310
  with gr.Blocks(title="海岸侵蚀分析系统") as demo:
311
  gr.Markdown("""# 海岸侵蚀分析系统
312
 
@@ -316,9 +317,10 @@ def create_interface():
316
  with gr.Row():
317
  loc1 = gr.Radio(list(MODEL_PATHS.keys()), label="选择模型", value=list(MODEL_PATHS.keys())[0])
318
  with gr.Row():
319
- inp = gr.Image(label="输入图像", type="numpy", image_mode="RGB")
320
- seg = gr.Image(label="分割图像", type="numpy", width=disp_w, height=disp_h)
321
- ovl = gr.Image(label="叠加图像", type="numpy", width=disp_w, height=disp_h)
 
322
  with gr.Row():
323
  btn1 = gr.Button("执行分割")
324
  url1 = gr.Text(label="分割图URL")
@@ -330,16 +332,17 @@ def create_interface():
330
  with gr.Row():
331
  loc2 = gr.Radio(list(MODEL_PATHS.keys()), label="选择模型", value=list(MODEL_PATHS.keys())[0])
332
  with gr.Row():
333
- ref_img = gr.Image(label="参考图像", type="numpy", image_mode="RGB")
334
- tgt_img = gr.Image(label="待分析图像", type="numpy", image_mode="RGB")
 
335
  with gr.Row():
336
  btn2 = gr.Button("执行空间对齐分割")
337
  with gr.Row():
338
- orig = gr.Image(label="原始图像", type="numpy", width=disp_w, height=disp_h)
339
- aligned = gr.Image(label="对齐后图像", type="numpy", width=disp_w, height=disp_h)
340
  with gr.Row():
341
- seg2 = gr.Image(label="分割图像", type="numpy", width=disp_w, height=disp_h)
342
- ovl2 = gr.Image(label="叠加图像", type="numpy", width=disp_w, height=disp_h)
343
  url2 = gr.Text(label="分割图URL")
344
  status2 = gr.HTML(label="空间对齐状态")
345
  res2 = gr.HTML(label="分析结果")
 
305
 
306
  # Create the Gradio interface
307
  def create_interface():
308
+ # 设置统一的显示尺寸
309
+ disp_w, disp_h = 683, 512 # 统一设置宽高比
310
+
311
  with gr.Blocks(title="海岸侵蚀分析系统") as demo:
312
  gr.Markdown("""# 海岸侵蚀分析系统
313
 
 
317
  with gr.Row():
318
  loc1 = gr.Radio(list(MODEL_PATHS.keys()), label="选择模型", value=list(MODEL_PATHS.keys())[0])
319
  with gr.Row():
320
+ # 确保所有图像组件使用相同的尺寸
321
+ inp = gr.Image(label="输入图像", type="numpy", image_mode="RGB", height=disp_h, width=disp_w)
322
+ seg = gr.Image(label="分割图像", type="numpy", height=disp_h, width=disp_w)
323
+ ovl = gr.Image(label="叠加图像", type="numpy", height=disp_h, width=disp_w)
324
  with gr.Row():
325
  btn1 = gr.Button("执行分割")
326
  url1 = gr.Text(label="分割图URL")
 
332
  with gr.Row():
333
  loc2 = gr.Radio(list(MODEL_PATHS.keys()), label="选择模型", value=list(MODEL_PATHS.keys())[0])
334
  with gr.Row():
335
+ # 确保所有图像组件使用相同的尺寸
336
+ ref_img = gr.Image(label="参考图像", type="numpy", image_mode="RGB", height=disp_h, width=disp_w)
337
+ tgt_img = gr.Image(label="待分析图像", type="numpy", image_mode="RGB", height=disp_h, width=disp_w)
338
  with gr.Row():
339
  btn2 = gr.Button("执行空间对齐分割")
340
  with gr.Row():
341
+ orig = gr.Image(label="原始图像", type="numpy", height=disp_h, width=disp_w)
342
+ aligned = gr.Image(label="对齐后图像", type="numpy", height=disp_h, width=disp_w)
343
  with gr.Row():
344
+ seg2 = gr.Image(label="分割图像", type="numpy", height=disp_h, width=disp_w)
345
+ ovl2 = gr.Image(label="叠加图像", type="numpy", height=disp_h, width=disp_w)
346
  url2 = gr.Text(label="分割图URL")
347
  status2 = gr.HTML(label="空间对齐状态")
348
  res2 = gr.HTML(label="分析结果")