Spaces:
Running
on
Zero
Running
on
Zero
gpu
Browse files
app.py
CHANGED
@@ -19,6 +19,7 @@ image_size = 112
|
|
19 |
batch_size = 32
|
20 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
21 |
|
|
|
22 |
def load_model(model_path, feature_dim):
|
23 |
model = AutoencoderModule(feature_dim=feature_dim)
|
24 |
state_dict = torch.load(model_path)
|
@@ -39,6 +40,7 @@ def load_model(model_path, feature_dim):
|
|
39 |
print("Model loaded successfully.")
|
40 |
return model
|
41 |
|
|
|
42 |
def load_data(img_dir="resources/trainB/", image_size=112, batch_size=256):
|
43 |
filenames = load_filenames(img_dir)
|
44 |
train_X = filenames[:1000]
|
@@ -55,6 +57,7 @@ def load_data(img_dir="resources/trainB/", image_size=112, batch_size=256):
|
|
55 |
print("Data loaded successfully.")
|
56 |
return x
|
57 |
|
|
|
58 |
def load_keypoints(img_dir="resources/trainB/", image_size=112, batch_size=32):
|
59 |
filenames = load_filenames(img_dir)
|
60 |
train_X = filenames[:1000]
|
|
|
19 |
batch_size = 32
|
20 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
21 |
|
22 |
+
@spaces.GPU
|
23 |
def load_model(model_path, feature_dim):
|
24 |
model = AutoencoderModule(feature_dim=feature_dim)
|
25 |
state_dict = torch.load(model_path)
|
|
|
40 |
print("Model loaded successfully.")
|
41 |
return model
|
42 |
|
43 |
+
@spaces.GPU
|
44 |
def load_data(img_dir="resources/trainB/", image_size=112, batch_size=256):
|
45 |
filenames = load_filenames(img_dir)
|
46 |
train_X = filenames[:1000]
|
|
|
57 |
print("Data loaded successfully.")
|
58 |
return x
|
59 |
|
60 |
+
@spaces.GPU
|
61 |
def load_keypoints(img_dir="resources/trainB/", image_size=112, batch_size=32):
|
62 |
filenames = load_filenames(img_dir)
|
63 |
train_X = filenames[:1000]
|