     
     let imageClassifier =
       try TFLImageClassifier.imageClassifier(options: imageClassifierOptions!)
-      
-    let imagePath = try XCTUnwrap(TFLImageClassifierTests.bundle.path(forResource: "burger_crop", ofType: "jpg"))
-    let image = UIImage(contentsOfFile: imagePath)
-    let imageForInference = try XCTUnwrap(image)
-    let gmlImage =  try XCTUnwrap(MLImage(image: imageForInference))
-      
+
+    let gmlImage = try gmlImage(withName:"burger_crop", ofType:"jpg");
     let classificationResults: TFLClassificationResult = try imageClassifier.classify(gmlImage:gmlImage)
       
     XCTAssertNotNil(classificationResults)

    let imageClassifier =
      try TFLImageClassifier.imageClassifier(options: imageClassifierOptions!)
    
    let imagePath = try XCTUnwrap(TFLImageClassifierTests.bundle.path(forResource: "burger_crop", ofType: "jpg"))
    let image = UIImage(contentsOfFile: imagePath)
    let imageForInference = try XCTUnwrap(image)
    let gmlImage =  try XCTUnwrap(MLImage(image: imageForInference))
    
    let classificationResults =
      try imageClassifier.classify(gmlImage: gmlImage)

        // Put teardown code here. This method is called after the invocation of each test method in the class.
    }

  func gmlImage(withName name:String, ofType type:String) throws -> MLImage {
    let imagePath = try XCTUnwrap(TFLImageClassifierTests.bundle.path(forResource: name, ofType: type))
    let image = UIImage(contentsOfFile: imagePath)
    let imageForInference = try XCTUnwrap(image)
    let gmlImage =  try XCTUnwrap(MLImage(image: imageForInference))

    return gmlImage
  }

  func testSuccessfullInferenceOnMLImageWithUIImage() throws {
      
    let modelPath = try XCTUnwrap(TFLImageClassifierTests.modelPath)
