Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,9 +57,12 @@ for model in models:
|
|
57 |
|
58 |
def inference(images, min_score, model_name):
|
59 |
results = []
|
60 |
-
for image in images:
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
63 |
|
64 |
model_id = model_name_to_id[model_name]
|
65 |
|
@@ -88,7 +91,7 @@ with gr.Blocks() as demo:
|
|
88 |
gr.Markdown(description)
|
89 |
|
90 |
with gr.Tab("From Image"):
|
91 |
-
image_input = gr.
|
92 |
|
93 |
min_score = gr.Slider(minimum=0.0, maximum=1.0, value=0.5, label="Minimum score")
|
94 |
|
|
|
57 |
|
58 |
def inference(images, min_score, model_name):
|
59 |
results = []
|
60 |
+
for image in images:
|
61 |
+
# Si la imagen es de tipo PIL, conviértela a NumPy
|
62 |
+
if isinstance(image, np.ndarray):
|
63 |
+
im = image[:, :, ::-1] # Convertir de RGB a BGR
|
64 |
+
else:
|
65 |
+
im = np.array(image)[:, :, ::-1] # Si es PIL, convertir a NumPy y cambiar a BGR
|
66 |
|
67 |
model_id = model_name_to_id[model_name]
|
68 |
|
|
|
91 |
gr.Markdown(description)
|
92 |
|
93 |
with gr.Tab("From Image"):
|
94 |
+
image_input = gr.Image(type="numpy", label="Input Image")
|
95 |
|
96 |
min_score = gr.Slider(minimum=0.0, maximum=1.0, value=0.5, label="Minimum score")
|
97 |
|