Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
from pyChatGPT import ChatGPT
|
3 |
-
import cloudpickle
|
4 |
|
5 |
os.system("pip install -U gradio")
|
6 |
|
@@ -98,9 +98,9 @@ def inference(img,unique_only):
|
|
98 |
object_list_str = []
|
99 |
|
100 |
|
101 |
-
masks = outputs["instances"].pred_masks
|
102 |
-
masks_screen = masks.cpu().numpy()
|
103 |
-
print(masks_screen)
|
104 |
|
105 |
box_locations = outputs["instances"].pred_boxes
|
106 |
box_loc_screen = box_locations.tensor.cpu().numpy()
|
@@ -132,8 +132,8 @@ def inference(img,unique_only):
|
|
132 |
|
133 |
return (
|
134 |
#Image.fromarray(np.uint8(out.get_image())).convert("RGB"),
|
135 |
-
json.dumps(detected_objects)
|
136 |
-
cloudpickle.dumps(masks_screen)
|
137 |
)
|
138 |
|
139 |
|
@@ -145,8 +145,8 @@ with gr.Blocks() as demo:
|
|
145 |
with gr.Column():
|
146 |
#outviz = gr.Image(label="Visualization", type="pil")
|
147 |
output_desc = gr.JSON(label="Detected Objects")
|
148 |
-
masks_screen = gr.Textbox(label="Masks binary", lines=1)
|
149 |
|
150 |
-
btn_detic.click(fn=inference, inputs=[inp,chk], outputs=[output_desc
|
151 |
|
152 |
demo.launch()
|
|
|
1 |
import os
|
2 |
from pyChatGPT import ChatGPT
|
3 |
+
#import cloudpickle
|
4 |
|
5 |
os.system("pip install -U gradio")
|
6 |
|
|
|
98 |
object_list_str = []
|
99 |
|
100 |
|
101 |
+
#masks = outputs["instances"].pred_masks
|
102 |
+
#masks_screen = masks.cpu().numpy()
|
103 |
+
#print(masks_screen)
|
104 |
|
105 |
box_locations = outputs["instances"].pred_boxes
|
106 |
box_loc_screen = box_locations.tensor.cpu().numpy()
|
|
|
132 |
|
133 |
return (
|
134 |
#Image.fromarray(np.uint8(out.get_image())).convert("RGB"),
|
135 |
+
json.dumps(detected_objects)
|
136 |
+
#cloudpickle.dumps(masks_screen)
|
137 |
)
|
138 |
|
139 |
|
|
|
145 |
with gr.Column():
|
146 |
#outviz = gr.Image(label="Visualization", type="pil")
|
147 |
output_desc = gr.JSON(label="Detected Objects")
|
148 |
+
#masks_screen = gr.Textbox(label="Masks binary", lines=1)
|
149 |
|
150 |
+
btn_detic.click(fn=inference, inputs=[inp,chk], outputs=[output_desc], api_name="detect")
|
151 |
|
152 |
demo.launch()
|