ivelin commited on
Commit
1b7baab
1 Parent(s): 93085f8

fix: cleanup

Browse files

Signed-off-by: ivelin <ivelin.eth@gmail.com>

Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -46,6 +46,7 @@ def process_refexp(image: Image, prompt: str):
46
 
47
  # postprocess
48
  sequence = processor.batch_decode(outputs.sequences)[0]
 
49
  sequence = sequence.replace(processor.tokenizer.eos_token, "").replace(
50
  processor.tokenizer.pad_token, "")
51
  # remove first task start token
@@ -59,10 +60,10 @@ def process_refexp(image: Image, prompt: str):
59
  print(f"image width, height: {width, height}")
60
  print(f"processed prompt: {prompt}")
61
 
62
- xmin = math.floor(width*bbox["xmin"])
63
- ymin = math.floor(height*bbox["ymin"])
64
- xmax = math.floor(width*bbox["xmax"])
65
- ymax = math.floor(height*bbox["ymax"])
66
 
67
  print(
68
  f"to image pixel values: xmin, ymin, xmax, ymax: {xmin, ymin, xmax, ymax}")
 
46
 
47
  # postprocess
48
  sequence = processor.batch_decode(outputs.sequences)[0]
49
+ print(f"predicted decoder sequence: {sequence}")
50
  sequence = sequence.replace(processor.tokenizer.eos_token, "").replace(
51
  processor.tokenizer.pad_token, "")
52
  # remove first task start token
 
60
  print(f"image width, height: {width, height}")
61
  print(f"processed prompt: {prompt}")
62
 
63
+ xmin = math.floor(width*bbox["xmin"]) if bbox.get("xmin") else 0
64
+ ymin = math.floor(height*bbox["ymin"]) if bbox.get("ymin") else 0
65
+ xmax = math.floor(width*bbox["xmax"]) if bbox.get("xmax") else 1
66
+ ymax = math.floor(height*bbox["ymax"]) if bbox.get("ymax") else 1
67
 
68
  print(
69
  f"to image pixel values: xmin, ymin, xmax, ymax: {xmin, ymin, xmax, ymax}")