original_docstring:  Function for viewing an image and it's predicted classes.
      
docstring: Function for viewing an image and it's predicted classes.
docstring_tokens: Function for viewing an image and it ' s predicted classes .
code: def view_classify(category_names, image_path, model, topk):
      ''' Function for viewing an image and it's predicted classes.
      '''
      with open(category_names, 'r') as f:
          cat_to_name = json.load(f) 
      probs, classes = predict(image_path, model, topk)
      names = [cat_to_name[c] for c in classes]
      flower = cat_to_name[image_path.split('/')[3]]
      
      fig, (ax1, ax2) = plt.subplots(figsize=(6,9), nrows=2)
      ax1.imshow(Image.open(image_path))
      ax1.axis('off')
      ax1.set_title(flower)
      
      ax2.barh(np.arange(topk), np.flip(probs, axis = 0))
      ax2.set_aspect(0.1)
      ax2.set_yticks(np.arange(topk))
      ax2.set_yticklabels(np.flip(names, axis = 0), size='small');
      ax2.set_xlim(0, 1.1)
      plt.tight_layout()
      plt.show()
code_tokens: def view_classify ( category_names , image_path , model , topk ) : with open ( category_names , 'r' ) as f : cat_to_name = json . load ( f ) probs , classes = predict ( image_path , model , topk ) names = [ cat_to_name [ c ] for c in classes ] flower = cat_to_name [ image_path . split ( '/' ) [ 3 ] ] fig , ( ax1 , ax2 ) = plt . subplots ( figsize = ( 6 , 9 ) , nrows = 2 ) ax1 . imshow ( Image . open ( image_path ) ) ax1 . axis ( 'off' ) ax1 . set_title ( flower ) ax2 . barh ( np . arange ( topk ) , np . flip ( probs , axis = 0 ) ) ax2 . set_aspect ( 0.1 ) ax2 . set_yticks ( np . arange ( topk ) ) ax2 . set_yticklabels ( np . flip ( names , axis = 0 ) , size = 'small' ) ; ax2 . set_xlim ( 0 , 1.1 ) plt . tight_layout ( ) plt . show ( )
short_docstring: Function for viewing an image and it's predicted classes.
short_docstring_tokens: Function for viewing an image and it ' s predicted classes .
comment: ''' Function for viewing an image and it's predicted classes.
      '''