Spaces:
Running
Running
File size: 1,063 Bytes
00921cc eaa1c71 8963e74 00921cc 8963e74 00921cc 8963e74 00921cc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# a minimal snippet for the whale viewer, for testing purposes
# - using AppTest to validate that the display_whale functionality
# is ok
# - currently placed in the src directory (not optimal) because
# I couldn't get pytest to pick it up from the tests directory.
# - TODO: find a cleaner solution for organisation (maybe just config to pytest?)
import streamlit as st
# to run streamlit from this subdir, we need the the src dir on the path
# NOTE: pytest doesn't need this to run the tests, but to develop the test
# harness is hard without running streamlit
import sys
from os import path
# src (parent from here)
src_dir = path.dirname( path.dirname( path.abspath(__file__) ) )
sys.path.append(src_dir)
import whale_viewer as whale_viewer
# a menu to pick one of the images
title = st.title("Whale Viewer testing")
species = st.selectbox("Species", whale_viewer.WHALE_CLASSES)
if species is not None:
# and display the image + reference
st.write(f"Selected species: {species}")
whale_viewer.display_whale([species], 0, st)
|