donb-hf commited on
Commit
20f775b
·
1 Parent(s): dfdd3a5

pass max_new_tokens

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -15,8 +15,8 @@ COLORS = ['#4285f4', '#db4437', '#f4b400', '#0f9d58', '#e48ef1']
15
  ##### Parse segmentation output tokens into masks
16
  ##### Also returns bounding boxes with their labels
17
 
18
- def parse_segmentation(input_image, input_text):
19
- out = pali_gemma_model.infer(input_image, input_text, max_new_tokens=100)
20
  objs = extract_objs(out.lstrip("\n"), input_image.size[0], input_image.size[1], unique_labels=True)
21
  labels = set(obj.get('name') for obj in objs if obj.get('name'))
22
  color_map = {l: COLORS[i % len(COLORS)] for i, l in enumerate(labels)}
@@ -72,7 +72,7 @@ with gr.Blocks(css="style.css") as demo:
72
  ]
73
  seg_btn.click(
74
  fn=parse_segmentation,
75
- inputs=seg_inputs,
76
  outputs=seg_outputs,
77
  )
78
  with gr.Tab("Text Generation"):
 
15
  ##### Parse segmentation output tokens into masks
16
  ##### Also returns bounding boxes with their labels
17
 
18
+ def parse_segmentation(input_image, input_text, max_new_tokens=100):
19
+ out = pali_gemma_model.infer(input_image, input_text, max_new_tokens=max_new_tokens)
20
  objs = extract_objs(out.lstrip("\n"), input_image.size[0], input_image.size[1], unique_labels=True)
21
  labels = set(obj.get('name') for obj in objs if obj.get('name'))
22
  color_map = {l: COLORS[i % len(COLORS)] for i, l in enumerate(labels)}
 
72
  ]
73
  seg_btn.click(
74
  fn=parse_segmentation,
75
+ inputs=[seg_inputs, "max_new_tokens"],
76
  outputs=seg_outputs,
77
  )
78
  with gr.Tab("Text Generation"):