Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -32,15 +32,19 @@ def predict(base64: str, queries: str, box_threshold: float, text_threshold: flo
|
|
32 |
text_threshold=text_threshold,
|
33 |
target_sizes=[image.size[::-1]]
|
34 |
)
|
35 |
-
return
|
|
|
|
|
|
|
|
|
36 |
|
37 |
demo = gr.Interface(
|
38 |
fn=predict,
|
39 |
inputs=[
|
40 |
gr.Text(label="Image (B64)"),
|
41 |
gr.Text(label="Queries, in lowercase, separated by full stop", placeholder="a bird. a blue bird."),
|
42 |
-
gr.Number(label="box_threshold"),
|
43 |
-
gr.Number(label="text_threshold")
|
44 |
],
|
45 |
outputs=gr.JSON(label="Predictions"),
|
46 |
)
|
|
|
32 |
text_threshold=text_threshold,
|
33 |
target_sizes=[image.size[::-1]]
|
34 |
)
|
35 |
+
return {
|
36 |
+
"scores": [float(s) for s in results[0]["scores"]],
|
37 |
+
"labels": results[0]["labels"],
|
38 |
+
"boxes": [[float(x) for x in box] for row in results[0]["boxes"]]
|
39 |
+
}
|
40 |
|
41 |
demo = gr.Interface(
|
42 |
fn=predict,
|
43 |
inputs=[
|
44 |
gr.Text(label="Image (B64)"),
|
45 |
gr.Text(label="Queries, in lowercase, separated by full stop", placeholder="a bird. a blue bird."),
|
46 |
+
gr.Number(label="box_threshold", placeholder=0.4),
|
47 |
+
gr.Number(label="text_threshold", placeholder=0.3)
|
48 |
],
|
49 |
outputs=gr.JSON(label="Predictions"),
|
50 |
)
|