Spaces:
Build error
Build error
Sujit Pal
commited on
Commit
·
70aaa1b
1
Parent(s):
19eeba4
fix: work around st.file_uploader bug by providing representative images
Browse files- dashboard_featurefinder.py +21 -8
- demo-images/Acopulco-Bay.jpg +0 -0
- demo-images/Eagle-Bay-Coastline.jpg +0 -0
- demo-images/Forest-with-River.jpg +0 -0
- demo-images/Highway-through-Forest.jpg +0 -0
- demo-images/Multistoreyed-Buildings.jpg +0 -0
- demo-images/St-Tropez-Port.jpg +0 -0
- demo-images/Street-View-Malayasia.jpg +0 -0
dashboard_featurefinder.py
CHANGED
|
@@ -23,6 +23,7 @@ IMAGE_VECTOR_FILE = "./vectors/test-bs128x8-lr5e-6-adam-ckpt-1.tsv"
|
|
| 23 |
|
| 24 |
# IMAGES_DIR = "/home/shared/data/rsicd_images"
|
| 25 |
IMAGES_DIR = "./images"
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
def split_image(X):
|
|
@@ -84,17 +85,29 @@ def app():
|
|
| 84 |
tiles are most likely to contain `houses`, and the two bottom right tiles
|
| 85 |
are likely to contain `boats`.
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
""")
|
| 92 |
-
buf = st.file_uploader("Upload Image for Analysis", type=["png", "jpg"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
searched_feature = st.text_input("Feature to find")
|
|
|
|
| 94 |
if st.button("Find"):
|
| 95 |
-
ftmp = NamedTemporaryFile()
|
| 96 |
-
ftmp.write(buf.getvalue())
|
| 97 |
-
image = plt.imread(ftmp.name)
|
|
|
|
| 98 |
if len(image.shape) != 3 and image.shape[2] != 3:
|
| 99 |
st.error("Image should be an RGB image")
|
| 100 |
if image.shape[0] < 224 or image.shape[1] < 224:
|
|
|
|
| 23 |
|
| 24 |
# IMAGES_DIR = "/home/shared/data/rsicd_images"
|
| 25 |
IMAGES_DIR = "./images"
|
| 26 |
+
DEMO_IMAGES_DIR = "./demo-images"
|
| 27 |
|
| 28 |
|
| 29 |
def split_image(X):
|
|
|
|
| 85 |
tiles are most likely to contain `houses`, and the two bottom right tiles
|
| 86 |
are likely to contain `boats`.
|
| 87 |
|
| 88 |
+
We have provided a few representative images from [Unsplash](https://unsplash.com/s/photos/aerial-view)
|
| 89 |
+
that you can experiment with. Use the image name to put in an initial feature
|
| 90 |
+
to look for, this will show the original image, and you will get more ideas
|
| 91 |
+
for features that you can ask the model to identify.
|
| 92 |
""")
|
| 93 |
+
# buf = st.file_uploader("Upload Image for Analysis", type=["png", "jpg"])
|
| 94 |
+
image_file = st.selectbox("Image File", index=0,
|
| 95 |
+
options=[
|
| 96 |
+
"St-Tropez-Port.jpg",
|
| 97 |
+
"Acopulco-Bay.jpg",
|
| 98 |
+
"Highway-through-Forest.jpg",
|
| 99 |
+
"Forest-with-River.jpg",
|
| 100 |
+
"Eagle-Bay-Coastline.jpg",
|
| 101 |
+
"Multistoreyed-Buildings.jpg",
|
| 102 |
+
"Street-View-Malayasia.jpg",
|
| 103 |
+
])
|
| 104 |
searched_feature = st.text_input("Feature to find")
|
| 105 |
+
|
| 106 |
if st.button("Find"):
|
| 107 |
+
# ftmp = NamedTemporaryFile()
|
| 108 |
+
# ftmp.write(buf.getvalue())
|
| 109 |
+
# image = plt.imread(ftmp.name)
|
| 110 |
+
image = plt.imread(os.path.join("demo-images", image_file))
|
| 111 |
if len(image.shape) != 3 and image.shape[2] != 3:
|
| 112 |
st.error("Image should be an RGB image")
|
| 113 |
if image.shape[0] < 224 or image.shape[1] < 224:
|
demo-images/Acopulco-Bay.jpg
ADDED
|
demo-images/Eagle-Bay-Coastline.jpg
ADDED
|
demo-images/Forest-with-River.jpg
ADDED
|
demo-images/Highway-through-Forest.jpg
ADDED
|
demo-images/Multistoreyed-Buildings.jpg
ADDED
|
demo-images/St-Tropez-Port.jpg
ADDED
|
demo-images/Street-View-Malayasia.jpg
ADDED
|