Class: Proposal::Classifier::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/proposal/classifier.rb

Class Method Summary collapse

Class Method Details

.base_urlObject



10
11
12
# File 'lib/proposal/classifier.rb', line 10

def self.base_url
  @base_url.dup
end

.base_url=(new_url) ⇒ Object



14
15
16
# File 'lib/proposal/classifier.rb', line 14

def self.base_url=(new_url)
  @base_url = new_url.dup
end

.initObject



18
19
20
21
# File 'lib/proposal/classifier.rb', line 18

def self.init()
  response_get = HTTP.get(@base_url.dup).body.to_s.dup
  return response_get.dup
end

.predict(input_text) ⇒ Object



23
24
25
26
# File 'lib/proposal/classifier.rb', line 23

def self.predict(input_text)
  response_post = HTTP.post(@base_url.dup + "/predict", :json => { :text => input_text }).body.to_s.dup
  return response_post.dup
end