Spaces:
Sleeping
Sleeping
Commit
·
083cd0d
1
Parent(s):
5662f96
add extra instructions
Browse files
app.py
CHANGED
|
@@ -28,8 +28,16 @@ if model_name is not None:
|
|
| 28 |
# Load the model
|
| 29 |
model = IndividualLandmarkViT.from_pretrained(model_name, input_size=image_size).eval().to(device)
|
| 30 |
num_parts = model.num_landmarks
|
| 31 |
-
amap_vis = VisualizeAttentionMaps(num_parts=num_parts+1, bg_label=num_parts)
|
| 32 |
test_transforms = make_test_transforms(image_size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
image_name = st.file_uploader("Upload Image", type=["jpg", "jpeg", "png"]) # Upload an image
|
| 34 |
if image_name is not None:
|
| 35 |
image = Image.open(image_name).convert("RGB")
|
|
|
|
| 28 |
# Load the model
|
| 29 |
model = IndividualLandmarkViT.from_pretrained(model_name, input_size=image_size).eval().to(device)
|
| 30 |
num_parts = model.num_landmarks
|
| 31 |
+
amap_vis = VisualizeAttentionMaps(num_parts=num_parts + 1, bg_label=num_parts)
|
| 32 |
test_transforms = make_test_transforms(image_size)
|
| 33 |
+
# Instructions
|
| 34 |
+
if "cub" or "nabirds" in model_name:
|
| 35 |
+
st.write("Upload an image of a bird to visualize the attention maps")
|
| 36 |
+
elif "flowers" in model_name:
|
| 37 |
+
st.write("Upload an image of a flower to visualize the attention maps")
|
| 38 |
+
else:
|
| 39 |
+
st.write("Upload an image of any PartImageNet class (land animals + fish + cars + airplanes) to visualize the attention maps")
|
| 40 |
+
|
| 41 |
image_name = st.file_uploader("Upload Image", type=["jpg", "jpeg", "png"]) # Upload an image
|
| 42 |
if image_name is not None:
|
| 43 |
image = Image.open(image_name).convert("RGB")
|
files/{images → bird_images}/Laysan_Albatross_0050_870.jpg
RENAMED
|
File without changes
|
files/flower_images/image_00327.jpg
ADDED
|
files/partimagenet_images/n01729322_13350.JPEG
ADDED
|
|