easy_ml 0.2.0.pre.rc88 → 0.2.0.pre.rc89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9a3eb82ce50657d230c9d00a75f84f7f09ce96b68d58fa8a1d615ad4fd31d77
4
- data.tar.gz: f0ded08a9c73232bcea3eb23b9e678bc392647873e53c425c6b21f62104c983b
3
+ metadata.gz: a0eb5ce84bdd93da3ea53e97f1b1ceab81a529a9bb076596f4edf7e49349eadf
4
+ data.tar.gz: 5262f39ff5a1236729d28a8fa6715d1b12e6dd5b4319225a6df512493872bba0
5
5
  SHA512:
6
- metadata.gz: 76b6f960c24f0032d4959f7435770f64245a5699f97150118127fac618e46965267ae996c3be3b4bb21a0734177c039ec2357b690a69ede3117c834e3ff09083
7
- data.tar.gz: 241ae30e3e2934eef6a74aae16aa05cfb1e10ed9145562045ccb93403c292b46449003badee5a0798a70987394469d6781b6ef8d14d5a552ee9da954efc75f44
6
+ metadata.gz: 8e8094ed3309b80e0ee70543667e7af982e0805ba6fe81a62ad2f46297eae4487440a4e6ffdca75f32ef045ef8b25440a8396032cf00f9fd6c191d63fc8c0386
7
+ data.tar.gz: 97d057eb4ffa2acdb319a52de427cc3f3e7c42db8de349d063b36cd91479c68eca10ec150689d11070f0d20f24b620c0ce7a77f3e335420dd8c73612d706d1a0
@@ -22,8 +22,16 @@ module EasyML
22
22
  return render json: { error: "Missing required fields: #{fields}" }, status: :not_found
23
23
  end
24
24
 
25
- prediction = EasyML::Predict.predict(slug, input)
25
+ type = (params[:type] || :predict).to_sym
26
+ allowed_types = [:predict, :predict_proba]
27
+ unless allowed_types.include?(type)
28
+ return render json: { error: "Invalid type: #{type}" }, status: :not_found
29
+ end
30
+
31
+ prediction = EasyML::Predict.send(type, slug, input)
26
32
 
33
+ render json: { prediction: EasyML::PredictionSerializer.new(prediction).serializable_hash.dig(:data, :attributes) }, status: :ok
34
+ rescue ActiveRecord::RecordNotFound
27
35
  render json: { prediction: EasyML::PredictionSerializer.new(prediction).serializable_hash.dig(:data, :attributes) }, status: :ok
28
36
  rescue ActiveRecord::RecordNotFound
29
37
  render json: { error: "Model not found" }, status: :not_found
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyML
4
- VERSION = "0.2.0-rc88"
4
+ VERSION = "0.2.0-rc89"
5
5
 
6
6
  module Version
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_ml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.rc88
4
+ version: 0.2.0.pre.rc89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Shollenberger