summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2019-07-10 09:01:52 +0000
committergebele <gebele@in-silico.ch>2019-07-10 09:01:52 +0000
commit2b48d7a57b340b2ffb344774529ed84430883035 (patch)
tree09231faa65b6869e7c6189fb8b673fa1419c1742
parent4793ee48de2535aa4f0ed5ab596a1bcb751c42c2 (diff)
ensure correct response content-type
-rw-r--r--application.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/application.rb b/application.rb
index db4c230..7cebb2b 100644
--- a/application.rb
+++ b/application.rb
@@ -168,10 +168,13 @@ post '/predict/?' do
model = Model::Validation.find model_id
t.update_percent(10)
prediction_dataset = model.predict input
+ t.update_percent(70)
t[:dataset_id] = prediction_dataset.id
- t.update_percent(90)
+ t.update_percent(75)
prediction[model_id] = prediction_dataset.id.to_s
+ t.update_percent(80)
t[:predictions] = prediction
+ t.update_percent(90)
t[:csv] = prediction_dataset.to_prediction_csv
t.update_percent(100)
t.save
@@ -208,6 +211,7 @@ end
get '/prediction/task/?' do
if params[:turi]
task = Task.find(params[:turi].to_s)
+ response['Content-Type'] = "application/json"
return JSON.pretty_generate(:percent => task.percent)
elsif params[:predictions]
task = Task.find(params[:predictions])
@@ -239,6 +243,7 @@ get '/prediction/task/?' do
end
string += "</tr>"
string += "</table></td>"
+ response['Content-Type'] = "application/json"
return JSON.pretty_generate(:prediction => [string])
end
end