Guest User

Untitled

a guest
Feb 16th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. Prediction failed: Error during model execution:
  2. AbortionError(code=StatusCode.INVALID_ARGUMENT, details="Expected image
  3. (JPEG, PNG, or GIF), got unknown format starting with
  4. 'u253Z212f240{370351z06332261356270377'
  5. [[{{node map/while/DecodeJpeg}} = DecodeJpeg[_output_shapes=[[?,?,3]],
  6. acceptable_fraction=1, channels=3, dct_method="", fancy_upscaling=true,
  7. ratio=1, try_recover_truncated=false, _device="/job:localhost/replica:0
  8. /task:0/device:CPU:0"](map/while/TensorArrayReadV3)]]")
  9.  
  10. <script type="text/javascript">
  11.  
  12.  
  13. function simulateClick(bunnyID) {
  14.  
  15. document.getElementById(bunnyID).click();
  16. }
  17.  
  18. $(document).ready(function () {
  19.  
  20. $("#loading").hide();
  21. $("span.mdl-chip").hide();
  22.  
  23. console.log("ready!");
  24.  
  25.  
  26. $("#settings-btn").click(function () {
  27. $("#versions").toggle();
  28. });
  29.  
  30. let base64Image;
  31. $("#image-selector").change(function () {
  32. let reader = new FileReader();
  33. reader.onload = function (e) {
  34. let dataURL = reader.result;
  35. $("#selected-image").attr("src", dataURL);
  36. base64Image = dataURL.replace("data:image/jpg;base64,","");
  37. console.log(base64Image);
  38. }
  39. let file = $("#image-selector").prop('files')[0];
  40. reader.readAsDataURL(file);
  41.  
  42. setTimeout(simulateClick.bind(null,'fake-predict-button'), 500);
  43.  
  44. });
  45.  
  46. $("#fake-predict-button").click(function () {
  47. let baseImage = {
  48. image: base64Image
  49. }
  50. console.log(baseImage);
  51.  
  52. $("span.mdl-chip").hide();
  53. $("#no-skins").hide();
  54. $("#loading").show();
  55.  
  56. var modelUrl;
  57. var modelSelection = $('input[name=options]:checked').val();
  58.  
  59. if (modelSelection === "1") {
  60. modelUrl = "test/versions/v1"
  61. } else {
  62. modelUrl = $("#custom").val()
  63. }
  64.  
  65.  
  66. $.ajax({
  67. type: "POST",
  68. url: "https://MY-HTTP-ENDPOINT",
  69.  
  70. data: {
  71. "instances": [{"image_bytes": {"b64": base64Image}}]},
  72.  
  73. JSON.stringify({
  74. "model": modelUrl}),
  75. },
  76.  
  77. contentType: "application/json; charset=utf-8",
  78. dataType: "json",
Add Comment
Please, Sign In to add comment