|
import streamlit as st |
|
import albumentations as A |
|
|
|
from utils import ( |
|
load_augmentations_config, |
|
get_params_string |
|
) |
|
from visuals import ( |
|
show_transform_control, |
|
select_image, |
|
show_credentials, |
|
show_docstring, |
|
) |
|
|
|
|
|
|
|
st.title("Demo of Albumentations transforms") |
|
|
|
|
|
image = select_image(path_to_images="images") |
|
|
|
|
|
augmentations = load_augmentations_config("configs/augmentations.json") |
|
|
|
|
|
transform_name = st.sidebar.selectbox( |
|
"Select a transformation:", sorted(list(augmentations.keys())) |
|
) |
|
|
|
|
|
param_values = show_transform_control(augmentations[transform_name]) |
|
|
|
|
|
transform = getattr(A, transform_name)(**param_values) |
|
augmented_image = transform(image=image)["image"] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st.image( |
|
[image, augmented_image], |
|
caption=["Original image", "Transformed image"], |
|
width=335, |
|
) |
|
|
|
|
|
st.code(str(transform)) |
|
show_docstring(transform) |
|
show_credentials() |
|
|