jatamura commited on
Commit
2f0eb6c
·
verified ·
1 Parent(s): a84661d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -61,10 +61,10 @@ def plot_ui():
61
  def plot_server(input, output, session, r, v, colours):
62
  opacity = reactive.value(0.5)
63
 
64
- @reactive.effect
65
- @reactive.event(input.opacity_slider)
66
- def _():
67
- opacity.set(input.opacity_slider())
68
 
69
  @render.plot
70
  def plot_prediction():
@@ -72,15 +72,15 @@ def plot_server(input, output, session, r, v, colours):
72
 
73
  out = v.overlay_instances(masks = r["instances"].pred_masks.to("cpu"),
74
  assigned_colors = colours,
75
- alpha = opacity())
76
 
77
  # ax = plt.Axes(fig, [0., 0., 1., 1.])
78
  ax.set_axis_off()
79
  # fig.add_axes(ax)
80
 
81
  ax.imshow(cv2.cvtColor(out.get_image()[:, :, ::-1], cv2.COLOR_BGR2RGB))
82
- # fig.canvas.draw()
83
- # fig.canvas.flush_events()
84
 
85
  def server(input, output, session: Session):
86
  analysis_results = reactive.Value([])
 
61
  def plot_server(input, output, session, r, v, colours):
62
  opacity = reactive.value(0.5)
63
 
64
+ # @reactive.effect
65
+ # @reactive.event(input.opacity_slider)
66
+ # def _():
67
+ # opacity.set(input.opacity_slider())
68
 
69
  @render.plot
70
  def plot_prediction():
 
72
 
73
  out = v.overlay_instances(masks = r["instances"].pred_masks.to("cpu"),
74
  assigned_colors = colours,
75
+ alpha = input.opacity_slider())
76
 
77
  # ax = plt.Axes(fig, [0., 0., 1., 1.])
78
  ax.set_axis_off()
79
  # fig.add_axes(ax)
80
 
81
  ax.imshow(cv2.cvtColor(out.get_image()[:, :, ::-1], cv2.COLOR_BGR2RGB))
82
+ fig.canvas.draw()
83
+ fig.canvas.flush_events()
84
 
85
  def server(input, output, session: Session):
86
  analysis_results = reactive.Value([])