Spaces:
Runtime error
Runtime error
gchhablani
commited on
Commit
•
e1a3400
1
Parent(s):
c7cc540
Update app
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- app.py +3 -4
- resize_images.py +3 -3
- resized_images/val2014/COCO_val2014_000000000757.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000013466.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000015517.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000017018.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000023899.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000029465.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000032901.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000036607.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000046269.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000050165.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000066973.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000068411.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000074646.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000079837.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000084533.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000090255.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000095805.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000099177.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000109055.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000109316.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000111546.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000117328.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000117374.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000121031.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000132042.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000144935.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000151393.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000153011.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000156532.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000163348.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000163640.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000167353.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000169143.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000171255.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000187565.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000190585.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000190689.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000197716.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000208971.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000209602.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000230561.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000238537.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000242610.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000246717.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000260094.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000261758.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000270381.jpg +0 -0
- resized_images/val2014/COCO_val2014_000000277440.jpg +0 -0
app.py
CHANGED
@@ -103,10 +103,9 @@ if state.image_file is None:
|
|
103 |
image = plt.imread(image_path)
|
104 |
state.image = image
|
105 |
|
106 |
-
col1, col2, col3 = st.beta_columns([3,3,3])
|
107 |
-
|
108 |
-
|
109 |
-
if col2.button(
|
110 |
"Get a random example",
|
111 |
help="Get a random example from the 100 `seeded` image-text pairs.",
|
112 |
):
|
|
|
103 |
image = plt.imread(image_path)
|
104 |
state.image = image
|
105 |
|
106 |
+
# col1, col2, col3 = st.beta_columns([3,3,3])
|
107 |
+
|
108 |
+
if st.button(
|
|
|
109 |
"Get a random example",
|
110 |
help="Get a random example from the 100 `seeded` image-text pairs.",
|
111 |
):
|
resize_images.py
CHANGED
@@ -2,7 +2,7 @@ import cv2
|
|
2 |
import os
|
3 |
|
4 |
|
5 |
-
# A function to resize the images with longer side to
|
6 |
def resize_images(path, new_path):
|
7 |
if not os.path.exists(new_path):
|
8 |
os.makedirs(new_path)
|
@@ -11,10 +11,10 @@ def resize_images(path, new_path):
|
|
11 |
img = cv2.imread(os.path.join(path, filename))
|
12 |
height, width, channels = img.shape
|
13 |
if height > width:
|
14 |
-
new_height =
|
15 |
new_width = int(width * new_height / height)
|
16 |
else:
|
17 |
-
new_width =
|
18 |
new_height = int(height * new_width / width)
|
19 |
img = cv2.resize(img, (new_width, new_height), interpolation=cv2.INTER_CUBIC)
|
20 |
cv2.imwrite(os.path.join(new_path, filename), img)
|
|
|
2 |
import os
|
3 |
|
4 |
|
5 |
+
# A function to resize the images with longer side to 300 pixels with cubic interpolation and save to a new directory
|
6 |
def resize_images(path, new_path):
|
7 |
if not os.path.exists(new_path):
|
8 |
os.makedirs(new_path)
|
|
|
11 |
img = cv2.imread(os.path.join(path, filename))
|
12 |
height, width, channels = img.shape
|
13 |
if height > width:
|
14 |
+
new_height = 300
|
15 |
new_width = int(width * new_height / height)
|
16 |
else:
|
17 |
+
new_width = 300
|
18 |
new_height = int(height * new_width / width)
|
19 |
img = cv2.resize(img, (new_width, new_height), interpolation=cv2.INTER_CUBIC)
|
20 |
cv2.imwrite(os.path.join(new_path, filename), img)
|
resized_images/val2014/COCO_val2014_000000000757.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000013466.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000015517.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000017018.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000023899.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000029465.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000032901.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000036607.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000046269.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000050165.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000066973.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000068411.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000074646.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000079837.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000084533.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000090255.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000095805.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000099177.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000109055.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000109316.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000111546.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000117328.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000117374.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000121031.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000132042.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000144935.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000151393.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000153011.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000156532.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000163348.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000163640.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000167353.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000169143.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000171255.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000187565.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000190585.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000190689.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000197716.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000208971.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000209602.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000230561.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000238537.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000242610.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000246717.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000260094.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000261758.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000270381.jpg
CHANGED
resized_images/val2014/COCO_val2014_000000277440.jpg
CHANGED