Anika232 commited on
Commit
444ccad
·
verified ·
1 Parent(s): 08b38b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -30
app.py CHANGED
@@ -37,36 +37,36 @@ if uploaded_file is not None:
37
 
38
  # Define constants or variables for model execution
39
  MODEL_NAME = 'dsrnet_s'
40
- MODEL_PATH = 'dsrnet_model_sirs'
41
- DATASET = 'sirs_dataset'
42
- NAME = 'dsrnet_s_test'
43
- BASE_DIR = './real45'
44
- WEIGHT_PATH = './weights/dsrnet_s_epoch14.pt'
45
-
46
- # Function to run the command
47
- def run_command(command):
48
- try:
49
- process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
50
- stdout, stderr = process.communicate()
51
- return stdout.decode('utf-8'), stderr.decode('utf-8')
52
- except Exception as e:
53
- return "", str(e)
54
-
55
- # Command to execute
56
- 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}"
57
-
58
- # Display running command
59
- st.write(f"Running command: {command}")
60
-
61
- # Execute the command
62
- stdout, stderr = run_command(command)
63
-
64
- # Display command output
65
- st.write("Command Output:")
66
- if stdout:
67
- st.code(stdout)
68
- if stderr:
69
- st.error(f"Command Error:\n{stderr}")
70
 
71
  # Search for image ending with '_l' in subdirectories of 'checkpoints'
72
  checkpoints_dir = './test' # Update this path according to your project structure
 
37
 
38
  # Define constants or variables for model execution
39
  MODEL_NAME = 'dsrnet_s'
40
+ MODEL_PATH = 'dsrnet_model_sirs'
41
+ DATASET = 'sirs_dataset'
42
+ NAME = 'dsrnet_s_test'
43
+ BASE_DIR = './real45'
44
+ WEIGHT_PATH = './weights/dsrnet_s_epoch14.pt'
45
+
46
+ # Function to run the command
47
+ def run_command(command):
48
+ try:
49
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
50
+ stdout, stderr = process.communicate()
51
+ return stdout.decode('utf-8'), stderr.decode('utf-8')
52
+ except Exception as e:
53
+ return "", str(e)
54
+
55
+ # Command to execute
56
+ 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}"
57
+
58
+ # Display running command
59
+ st.write(f"Running command: {command}")
60
+
61
+ # Execute the command
62
+ stdout, stderr = run_command(command)
63
+
64
+ # Display command output
65
+ st.write("Command Output:")
66
+ if stdout:
67
+ st.code(stdout)
68
+ if stderr:
69
+ st.error(f"Command Error:\n{stderr}")
70
 
71
  # Search for image ending with '_l' in subdirectories of 'checkpoints'
72
  checkpoints_dir = './test' # Update this path according to your project structure