tdurbor commited on
Commit
af422ae
·
1 Parent(s): 1f1720f

limit image height for visible buttons

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -205,12 +205,13 @@ function load_zoom() {
205
  def gradio_interface():
206
  """Create and return the Gradio interface."""
207
  with gr.Blocks(js=js, fill_width=True) as demo:
208
- gr.Markdown("#Background Removal Arena: Compare & Test the Best Background Removal Models")
209
  button_name = "Difference between masks"
210
 
211
  with gr.Tabs() as tabs:
212
  with gr.Tab("⚔️ Arena (battle)", id=0):
213
  image_width = None
 
214
 
215
  with gr.Row(equal_height=True):
216
  def on_enter_contest(username):
@@ -247,9 +248,9 @@ def gradio_interface():
247
  state_filename = gr.State("")
248
  state_model_a_name = gr.State("")
249
  state_model_b_name = gr.State("")
250
- image_a = gr.Image(label="Image A", width=image_width)
251
- input_image_display = gr.AnnotatedImage(label="Input Image", width=image_width)
252
- image_b = gr.Image(label="Image B", width=image_width)
253
 
254
  # Refresh states to load new image data
255
 
@@ -264,11 +265,12 @@ def gradio_interface():
264
  state_model_b_name.value = model_b_name
265
 
266
  # Create new gr.Image components with updated values
267
- image_a = gr.Image(value=segmented_a, label="Image A", width=image_width)
268
- image_b = gr.Image(value=segmented_b, label="Image B", width=image_width)
269
  input_image_display = gr.AnnotatedImage(
270
  value=(input_image, [(mask_difference > 0, button_name)]),
271
- width=image_width
 
272
  )
273
 
274
  outputs = [
 
205
  def gradio_interface():
206
  """Create and return the Gradio interface."""
207
  with gr.Blocks(js=js, fill_width=True) as demo:
208
+ gr.Markdown("# Background Removal Arena: Compare & Test the Best Background Removal Models")
209
  button_name = "Difference between masks"
210
 
211
  with gr.Tabs() as tabs:
212
  with gr.Tab("⚔️ Arena (battle)", id=0):
213
  image_width = None
214
+ image_height = 600 # Limit image height to fit on a standard screen
215
 
216
  with gr.Row(equal_height=True):
217
  def on_enter_contest(username):
 
248
  state_filename = gr.State("")
249
  state_model_a_name = gr.State("")
250
  state_model_b_name = gr.State("")
251
+ image_a = gr.Image(label="Image A", width=image_width, height=image_height)
252
+ input_image_display = gr.AnnotatedImage(label="Input Image", width=image_width, height=image_height)
253
+ image_b = gr.Image(label="Image B", width=image_width, height=image_height)
254
 
255
  # Refresh states to load new image data
256
 
 
265
  state_model_b_name.value = model_b_name
266
 
267
  # Create new gr.Image components with updated values
268
+ image_a = gr.Image(value=segmented_a, label="Image A", width=image_width, height=image_height)
269
+ image_b = gr.Image(value=segmented_b, label="Image B", width=image_width, height=image_height)
270
  input_image_display = gr.AnnotatedImage(
271
  value=(input_image, [(mask_difference > 0, button_name)]),
272
+ width=image_width,
273
+ height=image_height
274
  )
275
 
276
  outputs = [