Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import subprocess | |
| import os | |
| st.title('Swin-Unet Model Testing') | |
| st.write('Click the button below to test the model on the test set.') | |
| if st.button('Test Model'): | |
| st.write('Testing in progress...') | |
| # Define the command to run the test script with correct paths | |
| command = [ | |
| 'python', 'src/test_isic.py', | |
| '--dataset', 'ISIC', | |
| '--cfg', 'src/configs/swin_tiny_patch4_window7_224_lite.yaml', | |
| '--is_savenii', | |
| '--root_path', 'src/datasets/test_npz', | |
| '--output_dir', 'src/outputs', | |
| '--max_epochs', '150', | |
| '--base_lr', '0.05', | |
| '--img_size', '224', | |
| '--batch_size', '24', | |
| '--list_dir', 'src/lists/ISIC' | |
| ] | |
| # Run the command and capture output | |
| result = subprocess.run(command, capture_output=True, text=True) | |
| st.subheader('Test Output:') | |
| st.code(result.stdout) | |
| if result.stderr: | |
| st.subheader('Errors:') | |
| st.code(result.stderr) | |
| # Optionally, display the latest log file | |
| log_dir = os.path.join('src', 'test_log', 'test_log_ISIC') | |
| if os.path.exists(log_dir): | |
| log_files = sorted([f for f in os.listdir(log_dir) if f.endswith('.txt')], reverse=True) | |
| if log_files: | |
| latest_log = os.path.join(log_dir, log_files[0]) | |
| st.subheader('Latest Log File:') | |
| with open(latest_log, 'r') as f: | |
| st.text(f.read()) |