Spaces:
Sleeping
Sleeping
examples
Browse files- app.py +15 -7
- coco_000000281759.jpg +0 -0
app.py
CHANGED
@@ -49,15 +49,27 @@ fiber_demo = GLIPDemo(
|
|
49 |
show_mask_heatmaps=False
|
50 |
)
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
def predict(image, text, ground_tokens=""):
|
53 |
ground_tokens = None if ground_tokens.strip() == "" else ground_tokens.strip().split(";")
|
54 |
-
result, _ = glip_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens)
|
55 |
-
fiber_result, _ = fiber_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens)
|
56 |
return result[:, :, [2, 1, 0]], fiber_result[:, :, [2, 1, 0]]
|
57 |
|
58 |
|
59 |
image = gr.inputs.Image()
|
60 |
|
|
|
|
|
61 |
gr.Interface(
|
62 |
description="Object Recognition with DesCo (https://github.com/liunian-harold-li/DesCo)",
|
63 |
fn=predict,
|
@@ -73,12 +85,8 @@ gr.Interface(
|
|
73 |
),
|
74 |
],
|
75 |
examples=[
|
76 |
-
["./coco_000000281759.jpg", "A green umbrella. A pink striped umbrella. A plain white umbrella.", ""],
|
77 |
-
["./coco_000000281759.jpg", "a flowery top. A blue dress. An orange shirt .", ""],
|
78 |
-
["./coco_000000281759.jpg", "a car . An electricity box .", ""],
|
79 |
["./1.jpg", "a train besides sidewalk", "train;sidewalk"],
|
|
|
80 |
],
|
81 |
article=Path("docs/intro.md").read_text()
|
82 |
).launch()
|
83 |
-
# ).launch(server_name="0.0.0.0", server_port=7000, share=True)
|
84 |
-
|
|
|
49 |
show_mask_heatmaps=False
|
50 |
)
|
51 |
|
52 |
+
athetics_params = {
|
53 |
+
"skip_name": False, # whether we overlay the phrase over the box
|
54 |
+
"override_color": (255, 255, 255), # box color, default is white
|
55 |
+
"text_size": 1.0,
|
56 |
+
"text_pixel": 3,
|
57 |
+
"box_alpha": 1.0,
|
58 |
+
"box_pixel": 5,
|
59 |
+
"text_offset_original": 8, # distance between text and box
|
60 |
+
}
|
61 |
+
|
62 |
def predict(image, text, ground_tokens=""):
|
63 |
ground_tokens = None if ground_tokens.strip() == "" else ground_tokens.strip().split(";")
|
64 |
+
result, _ = glip_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens, **athetics_params)
|
65 |
+
fiber_result, _ = fiber_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens, **athetics_params)
|
66 |
return result[:, :, [2, 1, 0]], fiber_result[:, :, [2, 1, 0]]
|
67 |
|
68 |
|
69 |
image = gr.inputs.Image()
|
70 |
|
71 |
+
|
72 |
+
|
73 |
gr.Interface(
|
74 |
description="Object Recognition with DesCo (https://github.com/liunian-harold-li/DesCo)",
|
75 |
fn=predict,
|
|
|
85 |
),
|
86 |
],
|
87 |
examples=[
|
|
|
|
|
|
|
88 |
["./1.jpg", "a train besides sidewalk", "train;sidewalk"],
|
89 |
+
["./2.jpg", "Bumblebee, yellow with black accents.", "Bumblebee"],
|
90 |
],
|
91 |
article=Path("docs/intro.md").read_text()
|
92 |
).launch()
|
|
|
|
coco_000000281759.jpg
DELETED
Binary file (187 kB)
|
|