diff options
author | Christoph Helma <helma@in-silico.ch> | 2019-09-03 13:45:36 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2019-09-03 13:45:36 +0200 |
commit | d1032e4f40d9fbb212e85e0db4f0ecd2e8ac9a88 (patch) | |
tree | 48922d60d750839dacd5d0a4a6e50ea3fe68da63 /views/upload.haml | |
parent | 5bb4c24c6cfc1ddfae14eb9543b283baae2d75be (diff) | |
parent | a84d9eabf1b921086a688f81df28b0f21ba4df19 (diff) |
development merged, git links in FAQ.md fixed1.4.0
Diffstat (limited to 'views/upload.haml')
-rw-r--r-- | views/upload.haml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/views/upload.haml b/views/upload.haml new file mode 100644 index 0000000..54faa5c --- /dev/null +++ b/views/upload.haml @@ -0,0 +1,28 @@ +%div.card + %a.btn.btn-outline-info{:href => "//#{$host_with_port}/predict"} + %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} + New Prediction +%div.card.bg-light{:id=>"uploadDataset"} + %div.card-body + %h3.card-title="Processing file #{@filename} to dataset." + %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_upload", :class=>"circle", :alt=>"processing"} + :javascript + $(document).ready(function() { + var aClient = new HttpClient(); + aClient.post('//#{$host_with_port}/predict', 'models=#{@models}&batchfile=#{@filename}', function(res1) { + var contentType = res1.getResponseHeader('content-type'); + if (contentType == "application/json"){ + var response = JSON.parse(res1.responseText); + } else { + var response = res1.responseText; + } + if (res1.status == 200 && response['models'] && response['dataset_id']){ + aClient.post('//#{$host_with_port}/predict', 'models='+response['models']+'&dataset_id='+response['dataset_id'], function(res2) { + $("body").html(res2.responseText); + }); + } + if (res1.status == 200 && contentType == "text/html"){ + $("body").html(response); + } + }); + }); |