tphung commited on
Commit
1476ed8
1 Parent(s): c41dcc5

Change distance

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -37,7 +37,7 @@ def compute_depth(image, preds):
37
  x = (pred["box"]["xmax"] - pred["box"]["xmin"]) // 2
38
  y = (pred["box"]["ymax"] - pred["box"]["ymin"]) // 2
39
  output.append({
40
- "distance": prediction[x][y]
41
  })
42
 
43
  return output
@@ -45,6 +45,7 @@ def compute_depth(image, preds):
45
  def process(image, text):
46
  items = text.split(".")
47
  preds = detector(image, candidate_labels=items)
 
48
  return [visualize_preds(image, preds), compute_depth(image, preds)]
49
 
50
  with gr.Blocks() as demo:
 
37
  x = (pred["box"]["xmax"] - pred["box"]["xmin"]) // 2
38
  y = (pred["box"]["ymax"] - pred["box"]["ymin"]) // 2
39
  output.append({
40
+ "distance": float(prediction[x][y])
41
  })
42
 
43
  return output
 
45
  def process(image, text):
46
  items = text.split(".")
47
  preds = detector(image, candidate_labels=items)
48
+
49
  return [visualize_preds(image, preds), compute_depth(image, preds)]
50
 
51
  with gr.Blocks() as demo: