# **************************************************************************** # # # # ::: :::::::: # # style_model.py :+: :+: :+: # # +:+ +:+ +:+ # # By: ebennace Tuple[np.array, float]: """ Generate a new image based on the style of the given input image. Args: `style_img_array` (np.array): The input style image as a NumPy array. `num_epochs` (int): The number of epochs for the style transfer process. Returns: Tuple[np.array, float]: A tuple containing the generated image as a NumPy array and the total time taken. """ target_style = init_style_target(self.model, style_img_array) self.generated_img = init_generated_img(style_img_array) start = time() for _ in tqdm(range(num_epochs)) : update_style( model=self.model, style_target=target_style, generated_img=self.generated_img, optimizer=self.optimizer ) end = time() total_time = round(end-start, 2) return (self.generated_img, total_time) # ======================================================================= #