Spaces:
Sleeping
Sleeping
Returned to GPU
Browse files
app.py
CHANGED
@@ -112,7 +112,7 @@ def get_args_parser():
|
|
112 |
parser.add_argument("--amp", action="store_true", help="Train with mixed precision")
|
113 |
return parser
|
114 |
|
115 |
-
|
116 |
# Get counting model.
|
117 |
def build_model_and_transforms(args):
|
118 |
normalize = T.Compose(
|
@@ -219,7 +219,7 @@ def get_ind_to_filter(text, word_ids, keywords):
|
|
219 |
|
220 |
return inds_to_filter
|
221 |
|
222 |
-
|
223 |
def count(image, text, prompts, state, device):
|
224 |
print("state: " + str(state))
|
225 |
keywords = "" # do not handle this for now
|
@@ -308,7 +308,7 @@ def count(image, text, prompts, state, device):
|
|
308 |
out_label = "Nothing specified to detect."
|
309 |
return (gr.Image(output_img, visible=True, label=out_label, show_label=True), gr.Number(label="Predicted Count", visible=True, value=boxes.shape[0]), new_submit_btn, gr.Tab(visible=True), step_3, state)
|
310 |
|
311 |
-
|
312 |
def count_main(image, text, prompts, device):
|
313 |
keywords = "" # do not handle this for now
|
314 |
# Handle no prompt case.
|
|
|
112 |
parser.add_argument("--amp", action="store_true", help="Train with mixed precision")
|
113 |
return parser
|
114 |
|
115 |
+
@spaces.GPU
|
116 |
# Get counting model.
|
117 |
def build_model_and_transforms(args):
|
118 |
normalize = T.Compose(
|
|
|
219 |
|
220 |
return inds_to_filter
|
221 |
|
222 |
+
@spaces.GPU
|
223 |
def count(image, text, prompts, state, device):
|
224 |
print("state: " + str(state))
|
225 |
keywords = "" # do not handle this for now
|
|
|
308 |
out_label = "Nothing specified to detect."
|
309 |
return (gr.Image(output_img, visible=True, label=out_label, show_label=True), gr.Number(label="Predicted Count", visible=True, value=boxes.shape[0]), new_submit_btn, gr.Tab(visible=True), step_3, state)
|
310 |
|
311 |
+
@spaces.GPU
|
312 |
def count_main(image, text, prompts, device):
|
313 |
keywords = "" # do not handle this for now
|
314 |
# Handle no prompt case.
|