import streamlit as st
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
st.title("VKX extraction viewer")
height_path = "tests/out/height.npy"
rgb_path = "tests/out/rgb.png"
st.sidebar.title("Files")
st.sidebar.write(height_path)
st.sidebar.write(rgb_path)
try:
height = np.load(height_path)
st.subheader("Height map (µm)")
fig, ax = plt.subplots(figsize=(6,6))
im = ax.imshow(height, origin='lower')
fig.colorbar(im, ax=ax, label='height (µm)')
st.pyplot(fig)
except Exception as e:
st.error(f"Could not load height map: {e}")
try:
img = Image.open(rgb_path)
st.subheader("Optical image (RGB)")
st.image(img, use_column_width=True)
except Exception as e:
st.warning(f"No RGB image available or cannot open it: {e}")