Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,6 +40,9 @@ def draw_detections(image, detections):
|
|
40 |
return final_pil_image
|
41 |
|
42 |
def get_pipeline_prediction(pil_image):
|
|
|
|
|
|
|
43 |
try:
|
44 |
pipeline_output = od_pipe(pil_image)
|
45 |
processed_image = draw_detections(pil_image, pipeline_output)
|
@@ -52,7 +55,7 @@ def get_pipeline_prediction(pil_image):
|
|
52 |
with gr.Blocks() as demo:
|
53 |
with gr.Row():
|
54 |
with gr.Column():
|
55 |
-
inp_image = gr.Image(label="Input image") #
|
56 |
btn_run = gr.Button('Run Detection')
|
57 |
with gr.Column():
|
58 |
with gr.Tab("Annotated Image"):
|
|
|
40 |
return final_pil_image
|
41 |
|
42 |
def get_pipeline_prediction(pil_image):
|
43 |
+
# Ensure the image is a PIL Image as expected by the model pipeline
|
44 |
+
if not isinstance(pil_image, Image.Image):
|
45 |
+
pil_image = Image.fromarray(pil_image.astype('uint8'), 'RGB')
|
46 |
try:
|
47 |
pipeline_output = od_pipe(pil_image)
|
48 |
processed_image = draw_detections(pil_image, pipeline_output)
|
|
|
55 |
with gr.Blocks() as demo:
|
56 |
with gr.Row():
|
57 |
with gr.Column():
|
58 |
+
inp_image = gr.Image(label="Input image", type="pil") # Ensure the input is loaded as a PIL Image
|
59 |
btn_run = gr.Button('Run Detection')
|
60 |
with gr.Column():
|
61 |
with gr.Tab("Annotated Image"):
|