diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-01-20 12:41:33 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-01-20 12:41:33 +0100 |
commit | b90e598248489797456fee4c6661cfbe62b8e8ec (patch) | |
tree | 6d9e96786e4f6b94b938a8ba5109cc7b36f4229b /application.rb | |
parent | ff73a102a87d9e8e409ddf925f2e9477d60cafa7 (diff) |
Sinatra app skeleton
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/application.rb b/application.rb new file mode 100644 index 0000000..add7646 --- /dev/null +++ b/application.rb @@ -0,0 +1,21 @@ +require 'sinatra' +require "sinatra/reloader" if development? +require_relative 'protein_corona.rb' +also_reload './protein_corona.rb' + +get '/?' do + @data = JSON.parse(File.read("./data.json")).select{|id,features| features["composition"]["Core composition"] == '[Au]'} # Silver has too may missing values + @example = @data[@data.keys.sample]["physchem"] + content_type :json + JSON.pretty_generate(@example) +end + +get '/predict/?' do +end + +post '/predict/?' do + @features = params + @neighbors = neighbors params + @features[@endpoint_name] = prediction @neighbors + @prediction = predict params +end |