class ImageClassificationWorkItemHandler extends AbstractLogOrThrowWorkItemHandler implements Cacheable {

	public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
		try {
			InputStream imageIS = null;
			Object inputImage = workItem.getParameter(PARAM_IMAGE);
			if (inputImage instanceof InputStream) {
				imageIS = (InputStream) inputImage;
			} else if (inputImage instanceof File) {
				imageIS = new FileInputStream((File) inputImage);
			} else if (inputImage instanceof URL) {
				imageIS = ((URL) inputImage).openStream();
			} else {
				throw new IllegalArgumentException("Input Parameter " + PARAM_IMAGE + " has an invalid type.");
			}
			Map<String, Object> results = new HashMap<String, Object>();
			Map<String, Double> predictions = classifier.classifyImage(imageIS);
			results.put(RESULT_PREDICTIONS, predictions);
			results.put(RESULT_PREDICTION, getPrediction(predictions));
			manager.completeWorkItem(workItem.getId(), results);
		} catch (Throwable cause) {
			System.out.println("Error running WIH: " + cause.getMessage());
			handleException(cause);
		}
	}

	public  ImageClassificationWorkItemHandler(ClassLoader cl, String model, String labels, int width, int height, int channels);
	public  ImageClassificationWorkItemHandler(File model, String labels, int width, int height, int channels);
	public  ImageClassificationWorkItemHandler(URL model, String labels, int width, int height, int channels);
	public  ImageClassificationWorkItemHandler(InputStream model, String labels, int width, int height, int channels);
	public  ImageClassificationWorkItemHandler(InputStream model, String labels, int width, int height, int channels, DataNormalization normalization);
	public  ImageClassificationWorkItemHandler();
	private  ImageClassificationWorkItemHandler(InputStream model, List<String> labels, int width, int height,
			int channels, DataNormalization normalization);

}