Spaces:
Runtime error
Runtime error
Change distance
Browse files
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:
|