Made call of model to device global in app.py file
Browse files
app.py
CHANGED
@@ -167,6 +167,7 @@ args = parser.parse_args()
|
|
167 |
|
168 |
device = get_device()
|
169 |
model, transform = build_model_and_transforms(args)
|
|
|
170 |
|
171 |
examples = [
|
172 |
["strawberry.jpg", "strawberry", {"image": "strawberry.jpg"}],
|
@@ -223,8 +224,6 @@ def get_ind_to_filter(text, word_ids, keywords):
|
|
223 |
@spaces.GPU
|
224 |
def count(image, text, prompts, state, device):
|
225 |
|
226 |
-
model.to(device)
|
227 |
-
|
228 |
keywords = "" # do not handle this for now
|
229 |
|
230 |
# Handle no prompt case.
|
@@ -316,8 +315,6 @@ def count(image, text, prompts, state, device):
|
|
316 |
|
317 |
@spaces.GPU
|
318 |
def count_main(image, text, prompts, device):
|
319 |
-
model.to(device)
|
320 |
-
|
321 |
keywords = "" # do not handle this for now
|
322 |
# Handle no prompt case.
|
323 |
if prompts is None:
|
|
|
167 |
|
168 |
device = get_device()
|
169 |
model, transform = build_model_and_transforms(args)
|
170 |
+
model = model.to(device)
|
171 |
|
172 |
examples = [
|
173 |
["strawberry.jpg", "strawberry", {"image": "strawberry.jpg"}],
|
|
|
224 |
@spaces.GPU
|
225 |
def count(image, text, prompts, state, device):
|
226 |
|
|
|
|
|
227 |
keywords = "" # do not handle this for now
|
228 |
|
229 |
# Handle no prompt case.
|
|
|
315 |
|
316 |
@spaces.GPU
|
317 |
def count_main(image, text, prompts, device):
|
|
|
|
|
318 |
keywords = "" # do not handle this for now
|
319 |
# Handle no prompt case.
|
320 |
if prompts is None:
|