channel = None DIALOG = True if (DIALOG): # ----------------- DIALOG TO FILL GLOBAL PARAMETERS ----- gui = GenericDialog("Parameters") gui.addStringField("NGROK Server address :", "0.tcp.ngrok.io") gui.addStringField("PORT :", "") gui.showDialog() HOST = gui.getNextString() PORT = int(gui.getNextString()) gui = GenericDialogPlus("Parameters") gui.addFileField("Select a model file in Keras format (*.h5) : ", "") gui.showDialog() if gui.wasOKed(): LOCAL_MODEL_FILENAME = gui.getNextString() gui = GenericDialogPlus("Parameters") gui.addFileField("Select a python script file to upload on the server (*.py) : ", "") gui.showDialog() if gui.wasOKed(): LOCAL_PREDICTION_SCRIPT = gui.getNextString() jsch=JSch() # SSH Connection to DeepLearning server IJ.log("-- Connection to FiGoCo Server")
channel = None DIALOG = True if (DIALOG): # ----------------- DIALOG TO FILL GLOBAL PARAMETERS ----- gui = GenericDialog("Parameters") gui.addStringField("NGROK Server address :", "0.tcp.ngrok.io") gui.addStringField("PORT :", "") gui.showDialog() HOST = gui.getNextString() PORT = int(gui.getNextString()) gui = GenericDialogPlus("Parameters") gui.addFileField("Select an input file (*.tif) : ", "") gui.showDialog() if gui.wasOKed(): LOCAL_IMAGE_FILENAME = gui.getNextString() LOCAL_RESULT_FILENAME = LOCAL_IMAGE_FILENAME + "_prediction.tif" jsch = JSch() # SSH Connection to DeepLearning server IJ.log("-- Connection to Deep Learning Server") time0 = time.time() session = jsch.getSession("root", HOST, PORT) session.setPassword("12345") session.setConfig("StrictHostKeyChecking", "no") session.connect()