Sha256: d1d4af03d0f58993673bb8253f7232b619ed24b98268bf46490e5bfa56985ec6
Contents?: true
Size: 559 Bytes
Versions: 11
Compression:
Stored size: 559 Bytes
Contents
module EasyML class PredictionsController < ApplicationController skip_before_action :verify_authenticity_token, only: [:create] def create model_name = params[:model] input = params[:input] predictions = EasyML::Predict.predict(model_name, input) render json: { prediction: predictions.first } rescue ActiveRecord::RecordNotFound render json: { error: "Model not found" }, status: :not_found rescue StandardError => e render json: { error: e.message }, status: :unprocessable_entity end end end
Version data entries
11 entries across 11 versions & 1 rubygems