class HomeController < ApplicationController

  def index
    @latest_galleries = Gallery.order("id DESC").limit(8)
  end

  def picture_recognition
  end

  def picture_recognition_process
    @picture_url = params[:image_url]
    if @picture_url.present?
  	  @picture_name = params[:image_url].which_car if @picture_url.present?
    else
      if params[:files].present?
        @picture = PictureRecognition.new
        @picture.picture = params[:files][0]
        if @picture.save
          respond_to do |format|
            format.json {  
                render :json => [@picture.to_jq_upload].to_json           
              }
          end
        else
          respond_to do |format|
            format.json {  
                render :json => [{:error => "custom_failure"}], :status => 304
              }
          end
        end
      end
    end
  end


end
