Spaces:
Running
on
Zero
Running
on
Zero
markany-yhkwon
commited on
Commit
·
9be9c3b
1
Parent(s):
4a72a2c
bug fix
Browse files
app.py
CHANGED
@@ -65,6 +65,12 @@ model = load_model_hf(config_file, ckpt_repo_id, ckpt_filenmae)
|
|
65 |
|
66 |
@spaces.GPU
|
67 |
def run_grounding(input_image, grounding_caption, box_threshold, text_threshold):
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
init_image = input_image.convert("RGB")
|
69 |
original_size = init_image.size
|
70 |
|
@@ -100,7 +106,7 @@ if __name__ == "__main__":
|
|
100 |
|
101 |
with gr.Row():
|
102 |
with gr.Column():
|
103 |
-
input_image = gr.Image(label="Input Image")
|
104 |
grounding_caption = gr.Textbox(label="Detection Prompt")
|
105 |
run_button = gr.Button("Run")
|
106 |
|
|
|
65 |
|
66 |
@spaces.GPU
|
67 |
def run_grounding(input_image, grounding_caption, box_threshold, text_threshold):
|
68 |
+
# Convert numpy array to PIL Image if needed
|
69 |
+
if isinstance(input_image, np.ndarray):
|
70 |
+
if input_image.ndim == 3:
|
71 |
+
input_image = cv2.cvtColor(input_image, cv2.COLOR_BGR2RGB)
|
72 |
+
input_image = Image.fromarray(input_image)
|
73 |
+
|
74 |
init_image = input_image.convert("RGB")
|
75 |
original_size = init_image.size
|
76 |
|
|
|
106 |
|
107 |
with gr.Row():
|
108 |
with gr.Column():
|
109 |
+
input_image = gr.Image(label="Input Image", type="pil")
|
110 |
grounding_caption = gr.Textbox(label="Detection Prompt")
|
111 |
run_button = gr.Button("Run")
|
112 |
|