proposal-classifier 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 893a46b5e6065062c274ee5246157547908099fd6ee57f151755162faef368b3
4
- data.tar.gz: 4a679e68b111835288a15919e5908350170ea5b97f3d9fa35632b3e95d097ef1
3
+ metadata.gz: cf1309a56ecc06c6fa3dd7cf68bee6c90ad53dfec0a3bd03a270d176ca3027b5
4
+ data.tar.gz: 2a40dec4fa0a1ee792ce469da4ebd903cf49fc4ff204f0eb4844785221df3f4c
5
5
  SHA512:
6
- metadata.gz: 429fbbdb58a211a5dd38e2a6fc18195fc4acac91cdc01b20b0450d1738d40d50d2cf9c75606382d9eebc7cb5ae6a176452469ec687a83db2bdd20592ae07d306
7
- data.tar.gz: 2ac79390660c14d39bb2f9988ffe29fe805f019022a3075f77306245044676b43f9229b9a7b68c5aedcca119d37168f414e17a6b838ee99b3c9191884d01b4bb
6
+ metadata.gz: e9bf6b46455af21d87d03267b5deff7428fde93cffe6c3aabffa4c639f1ce372c63ac6ca40cd9b5b7057bfaa9d396608483de62e714eff6a9721a9898496de22
7
+ data.tar.gz: be3391454f71cfe9bb2e83126de3de845358c834bbeab819ab1bf5ee36126b750da0386319038a79c23824d61e6b3ee2c466c5c72ac13f50a86d44ee1226a4ed
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: false
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
@@ -1,7 +1,7 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: false
2
2
 
3
3
  module Proposal
4
4
  module Classifier
5
- VERSION = "0.4.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -1,24 +1,28 @@
1
- # frozen_string_literal: true
2
- require 'onnxruntime'
3
- require 'ruby-spacy'
4
- require 'pycall/import'
5
- include PyCall::Import
1
+ # frozen_string_literal: false
6
2
 
7
- require_relative "classifier/version"
3
+ require "http"
8
4
 
9
5
  module Proposal
10
6
  module Classifier
11
7
  class Model
12
- def self.predict_onx(input_text, onnx_model_path)
13
- nlp = Spacy::Language.new("pt_core_news_lg")
14
- doc = nlp.read(input_text)
15
- vector = doc.vector
16
- scaled_array = (vector - vector.min) / (vector.max - vector.min) * (1 - 0) + 0
17
- model = OnnxRuntime::InferenceSession.new(onnx_model_path)
18
- label_name = model.outputs()[0][:name]
19
- vector_fim_reshaped = scaled_array.reshape(1, -1)
20
- pred_onx = model.run([label_name], {X: vector_fim_reshaped})[0]
21
- return pred_onx
8
+ @base_url = "http://0.0.0.0" # Default base URL
9
+
10
+ def self.base_url
11
+ @base_url.dup
12
+ end
13
+
14
+ def self.base_url=(new_url)
15
+ @base_url = new_url.dup
16
+ end
17
+
18
+ def self.init()
19
+ response_get = HTTP.get(@base_url.dup).body.to_s.dup
20
+ return response_get.dup
21
+ end
22
+
23
+ def self.predict(input_text)
24
+ response_post = HTTP.post(@base_url.dup + "/predict", :json => { :text => input_text }).body.to_s.dup
25
+ return response_post.dup
22
26
  end
23
27
  end
24
28
  end
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: false
2
2
 
3
3
  require_relative "lib/proposal/classifier/version"
4
4
 
@@ -31,9 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  # Uncomment to register a new dependency of your gem
34
- spec.add_dependency "onnxruntime", "~> 0.7.6"
35
- spec.add_dependency "ruby-spacy", "~> 0.1.5.4"
36
- spec.add_dependency "pycall", "~> 1.4.2"
34
+ spec.add_dependency "http", "~> 3.0"
37
35
 
38
36
  # For more information and examples about making a new gem, check out our
39
37
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,57 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proposal-classifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - chaydson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-06 00:00:00.000000000 Z
11
+ date: 2023-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: onnxruntime
14
+ name: http
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.6
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.6
27
- - !ruby/object:Gem::Dependency
28
- name: ruby-spacy
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.1.5.4
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.1.5.4
41
- - !ruby/object:Gem::Dependency
42
- name: pycall
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 1.4.2
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 1.4.2
26
+ version: '3.0'
55
27
  description: Write a longer description or delete this line.
56
28
  email:
57
29
  - chaydson14@gmail.com
@@ -68,7 +40,6 @@ files:
68
40
  - Rakefile
69
41
  - lib/proposal/classifier.rb
70
42
  - lib/proposal/classifier/version.rb
71
- - lib/proposal/exported_model.onnx
72
43
  - proposal-classifier.gemspec
73
44
  - sig/proposal/classifier.rbs
74
45
  homepage: https://github.com/chaydson/proposal-classifier
Binary file