Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,15 +71,20 @@ def image_movement(input1, input2):
|
|
| 71 |
def get_sample_images(num_images):
|
| 72 |
sample_images = []
|
| 73 |
for i in range(num_images):
|
| 74 |
-
test_feature =
|
| 75 |
test_feature_2d =test_feature.reshape(28,28)
|
| 76 |
|
| 77 |
# Make it unsigned integers:
|
| 78 |
data = test_feature_2d.astype(np.uint8)
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
return sample_images
|
| 82 |
-
|
| 83 |
sample_images = get_sample_images(10)
|
| 84 |
|
| 85 |
|
|
|
|
| 71 |
def get_sample_images(num_images):
|
| 72 |
sample_images = []
|
| 73 |
for i in range(num_images):
|
| 74 |
+
test_feature = X_test[i]
|
| 75 |
test_feature_2d =test_feature.reshape(28,28)
|
| 76 |
|
| 77 |
# Make it unsigned integers:
|
| 78 |
data = test_feature_2d.astype(np.uint8)
|
| 79 |
|
| 80 |
+
outdir = "images_folder"
|
| 81 |
+
img_path = os.path.join(outdir, 'local_%05d.png' % (i,))
|
| 82 |
+
if not os.path.exists(outdir):
|
| 83 |
+
os.mkdir(outdir)
|
| 84 |
+
cv2.imwrite(img_path, data)
|
| 85 |
+
|
| 86 |
+
sample_images.append([img_path,np.random.choice(['shift up', 'shift down', 'shift left', 'shift right', 'rotate left', 'rotate right'])]) # ["image path", "K"]
|
| 87 |
return sample_images
|
|
|
|
| 88 |
sample_images = get_sample_images(10)
|
| 89 |
|
| 90 |
|