comparison utils.py @ 3:02f7746e7772 draft default tip

planemo upload for repository https://github.com/goeckslab/Galaxy-Pycaret commit ff6d674ecc83db933153b797ef4dbde17f07b10e
author goeckslab
date Wed, 01 Jan 2025 03:19:40 +0000
parents 915447b14520
children
comparison
equal deleted inserted replaced
2:009b18a75dc3 3:02f7746e7772
1 import base64 1 import base64
2 import logging 2 import logging
3
4 import numpy as np
3 5
4 logging.basicConfig(level=logging.DEBUG) 6 logging.basicConfig(level=logging.DEBUG)
5 LOG = logging.getLogger(__name__) 7 LOG = logging.getLogger(__name__)
6 8
7 9
153 155
154 def encode_image_to_base64(image_path): 156 def encode_image_to_base64(image_path):
155 """Convert an image file to a base64 encoded string.""" 157 """Convert an image file to a base64 encoded string."""
156 with open(image_path, "rb") as img_file: 158 with open(image_path, "rb") as img_file:
157 return base64.b64encode(img_file.read()).decode("utf-8") 159 return base64.b64encode(img_file.read()).decode("utf-8")
160
161
162 def predict_proba(self, X):
163 pred = self.predict(X)
164 return np.array([1-pred, pred]).T