Update app.py (#1)
Browse files- Update app.py (9c1ff0d01cff4d6e3d905fe07e5c6924ee470b7b)
Co-authored-by: Farz <Anika232@users.noreply.huggingface.co>
app.py
CHANGED
|
@@ -27,6 +27,7 @@ if uploaded_file is not None:
|
|
| 27 |
DATASET = 'sirs_dataset'
|
| 28 |
NAME = 'dsrnet_s_test'
|
| 29 |
BASE_DIR = tmp_file_path
|
|
|
|
| 30 |
|
| 31 |
# Function to run the command
|
| 32 |
def run_command(command):
|
|
@@ -35,8 +36,8 @@ if uploaded_file is not None:
|
|
| 35 |
return stdout, stderr
|
| 36 |
|
| 37 |
# Command execution
|
| 38 |
-
st.write(f"Running command: python ./DSRNet/test_sirs.py --inet {MODEL_NAME} --model {MODEL_PATH} --dataset {DATASET} --name {NAME} --hyper --if_align --base_dir '{BASE_DIR}'")
|
| 39 |
-
stdout, stderr = run_command(f"python ./DSRNet/test_sirs.py --inet {MODEL_NAME} --model {MODEL_PATH} --dataset {DATASET} --name {NAME} --hyper --if_align --base_dir '{BASE_DIR}'")
|
| 40 |
|
| 41 |
# Display command output
|
| 42 |
st.write("Command Output:")
|
|
@@ -50,12 +51,6 @@ if uploaded_file is not None:
|
|
| 50 |
checkpoints_dir = './test' # Update this path according to your project structure
|
| 51 |
|
| 52 |
# Function to recursively find image ending with '_l'
|
| 53 |
-
def find_image_in_subdirs(root_dir):
|
| 54 |
-
for root, dirs, files in os.walk(root_dir):
|
| 55 |
-
for filename in files:
|
| 56 |
-
if filename.endswith('_l.png'): # Adjust file extension if needed
|
| 57 |
-
return os.path.join(root, filename)
|
| 58 |
-
return None
|
| 59 |
|
| 60 |
# Find the image file
|
| 61 |
desired_image = './test/dsrnet_s_l.png'
|
|
|
|
| 27 |
DATASET = 'sirs_dataset'
|
| 28 |
NAME = 'dsrnet_s_test'
|
| 29 |
BASE_DIR = tmp_file_path
|
| 30 |
+
WEIGHT_PATH = "./weights/dsrnet_s_epoch14.pt"
|
| 31 |
|
| 32 |
# Function to run the command
|
| 33 |
def run_command(command):
|
|
|
|
| 36 |
return stdout, stderr
|
| 37 |
|
| 38 |
# Command execution
|
| 39 |
+
st.write(f"Running command: python ./DSRNet/test_sirs.py --inet {MODEL_NAME} --model {MODEL_PATH} --dataset {DATASET} --name {NAME} --hyper --if_align --base_dir '{BASE_DIR} --resume --weight_path WEIGHT_PATH'")
|
| 40 |
+
stdout, stderr = run_command(f"python ./DSRNet/test_sirs.py --inet {MODEL_NAME} --model {MODEL_PATH} --dataset {DATASET} --name {NAME} --hyper --if_align --base_dir '{BASE_DIR} --resume --weight_path WEIGHT_PATH'")
|
| 41 |
|
| 42 |
# Display command output
|
| 43 |
st.write("Command Output:")
|
|
|
|
| 51 |
checkpoints_dir = './test' # Update this path according to your project structure
|
| 52 |
|
| 53 |
# Function to recursively find image ending with '_l'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
# Find the image file
|
| 56 |
desired_image = './test/dsrnet_s_l.png'
|