1+ # Copyright 2025 MONAI Consortium
2+ # Licensed under the Apache License, Version 2.0 (the "License");
3+ # you may not use this file except in compliance with the License.
4+ # You may obtain a copy of the License at
5+ # http://www.apache.org/licenses/LICENSE-2.0
6+ # Unless required by applicable law or agreed to in writing, software
7+ # distributed under the License is distributed on an "AS IS" BASIS,
8+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+ # See the License for the specific language governing permissions and
10+ # limitations under the License.
11+
12+ import argparse
113import importlib
214import logging
315import os
416import sys
517import threading
618from http import HTTPStatus
7- import argparse
819
920import requests
1021from flask import Flask , jsonify , request
@@ -65,8 +76,7 @@ def app_status_callback(summary):
6576 os .environ ["MONAI_INPUTPATH" ] = input_folder
6677 os .environ ["MONAI_OUTPUTPATH" ] = output_folder
6778 os .environ ["HOLOSCAN_INPUT_PATH" ] = input_folder # For Holoscan-based apps
68- os .environ ["HOLOSCAN_OUTPUT_PATH" ] = output_folder # For Holoscan-based apps
69-
79+ os .environ ["HOLOSCAN_OUTPUT_PATH" ] = output_folder # For Holoscan-based apps
7080
7181 # Dynamically import the application class from the specified module.
7282 logging .info (f"Loading application: { APP_MODULE_NAME } .{ APP_CLASS_NAME } " )
@@ -110,9 +120,7 @@ def process():
110120 callback_url = data .get ("callback_url" ) # Callback URL is optional
111121
112122 # Start the processing in a background thread.
113- thread = threading .Thread (
114- target = run_processing , args = (input_folder , output_folder , callback_url )
115- )
123+ thread = threading .Thread (target = run_processing , args = (input_folder , output_folder , callback_url ))
116124 thread .start ()
117125
118126 return jsonify ({"message" : "Processing started." }), HTTPStatus .ACCEPTED
@@ -136,4 +144,4 @@ def process():
136144 args = parser .parse_args ()
137145 host = args .host or os .environ .get ("FLASK_HOST" , "0.0.0.0" )
138146 port = args .port or int (os .environ .get ("FLASK_PORT" , 5000 ))
139- app .run (host = host , port = port )
147+ app .run (host = host , port = port )
0 commit comments