proposal-classifier 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proposal/classifier/version.rb +1 -1
- data/lib/proposal/classifier.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 893a46b5e6065062c274ee5246157547908099fd6ee57f151755162faef368b3
|
4
|
+
data.tar.gz: 4a679e68b111835288a15919e5908350170ea5b97f3d9fa35632b3e95d097ef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429fbbdb58a211a5dd38e2a6fc18195fc4acac91cdc01b20b0450d1738d40d50d2cf9c75606382d9eebc7cb5ae6a176452469ec687a83db2bdd20592ae07d306
|
7
|
+
data.tar.gz: 2ac79390660c14d39bb2f9988ffe29fe805f019022a3075f77306245044676b43f9229b9a7b68c5aedcca119d37168f414e17a6b838ee99b3c9191884d01b4bb
|
data/lib/proposal/classifier.rb
CHANGED
@@ -9,12 +9,12 @@ require_relative "classifier/version"
|
|
9
9
|
module Proposal
|
10
10
|
module Classifier
|
11
11
|
class Model
|
12
|
-
def self.predict_onx(input_text)
|
12
|
+
def self.predict_onx(input_text, onnx_model_path)
|
13
13
|
nlp = Spacy::Language.new("pt_core_news_lg")
|
14
14
|
doc = nlp.read(input_text)
|
15
15
|
vector = doc.vector
|
16
16
|
scaled_array = (vector - vector.min) / (vector.max - vector.min) * (1 - 0) + 0
|
17
|
-
model = OnnxRuntime::InferenceSession.new(
|
17
|
+
model = OnnxRuntime::InferenceSession.new(onnx_model_path)
|
18
18
|
label_name = model.outputs()[0][:name]
|
19
19
|
vector_fim_reshaped = scaled_array.reshape(1, -1)
|
20
20
|
pred_onx = model.run([label_name], {X: vector_fim_reshaped})[0]
|