import sys sys.path.append("signify/gan") import os import shutil import streamlit as st from signify.gan import test MEDIA_ROOT = 'results/media/messy_signatures/' GAN_ROOT = "results/gan/gan_signdata_kaggle/gan_ips/testB/" GAN_SELECTED ="results/gan/gan_signdata_kaggle/test_latest/images/" st.set_page_config(page_title="Clean messy signatures", page_icon="📈") st.markdown("# Clean messy signatures") st.write("""Clean the given messy signature""") st.session_state.predict = False if "predict" not in st.session_state else st.session_state.predict left, right = st.columns(2) selection = str(left.selectbox('Select Signature to clean', os.listdir(MEDIA_ROOT))) selection_image_left = MEDIA_ROOT+selection left.image(selection_image_left, use_column_width='always') st.session_state.selection = selection st.session_state.predict = st.button('Clean') if st.session_state.predict: print(selection_image_left) shutil.copy(selection_image_left, GAN_ROOT) print(os.listdir(GAN_ROOT)) test.clean() right.image(GAN_SELECTED + selection[:-4] + '_fake.png')