AronWolverine's picture
Added images and model using Git LFS
fb7733d
(function ($) {
"use strict";
// Spinner
var spinner = function () {
setTimeout(function () {
if ($('#spinner').length > 0) {
$('#spinner').removeClass('show');
}
}, 1);
};
spinner();
// Initiate the wowjs
new WOW().init();
// Sticky Navbar
$(window).scroll(function () {
if ($(this).scrollTop() > 300) {
$('.sticky-top').css('top', '0px');
} else {
$('.sticky-top').css('top', '-100px');
}
});
// Dropdown on mouse hover
const $dropdown = $(".dropdown");
const $dropdownToggle = $(".dropdown-toggle");
const $dropdownMenu = $(".dropdown-menu");
const showClass = "show";
$(window).on("load resize", function() {
if (this.matchMedia("(min-width: 992px)").matches) {
$dropdown.hover(
function() {
const $this = $(this);
$this.addClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "true");
$this.find($dropdownMenu).addClass(showClass);
},
function() {
const $this = $(this);
$this.removeClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "false");
$this.find($dropdownMenu).removeClass(showClass);
}
);
} else {
$dropdown.off("mouseenter mouseleave");
}
});
// Back to top button
$(window).scroll(function () {
if ($(this).scrollTop() > 300) {
$('.back-to-top').fadeIn('slow');
} else {
$('.back-to-top').fadeOut('slow');
}
});
$('.back-to-top').click(function () {
$('html, body').animate({scrollTop: 0}, 1500, 'easeInOutExpo');
return false;
});
// Facts counter
$('[data-toggle="counter-up"]').counterUp({
delay: 10,
time: 2000
});
// Header carousel
$(".header-carousel").owlCarousel({
autoplay: false,
smartSpeed: 1500,
items: 1,
dots: false,
loop: true,
nav : true,
navText : [
'<i class="bi bi-chevron-left"></i>',
'<i class="bi bi-chevron-right"></i>'
]
});
// Testimonials carousel
$(".testimonial-carousel").owlCarousel({
autoplay: false,
smartSpeed: 1000,
center: true,
dots: true,
loop: true,
responsive: {
0:{
items:1
},
768:{
items:2
},
992:{
items:3
}
}
});
$(document).ready(function () {
// Init
$('.image-section').hide();
$('.loader').hide();
$('#result').hide();
// Upload Preview
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#imagePreview').css('background-image', 'url(' + e.target.result + ')');
$('#imagePreview').hide();
$('#imagePreview').fadeIn(650);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imageUpload").change(function () {
$('.image-section').show();
$('#btn-predict').show();
$('#result').text('');
$('#result').hide();
readURL(this);
});
// Predict
$('#btn-predict').click(function () {
var form_data = new FormData($('#upload-file')[0]);
// Show loading animation
$(this).hide();
$('.loader').show();
// Make prediction by calling api /predict
$.ajax({
type: 'POST',
url: '/predict',
data: form_data,
contentType: false,
cache: false,
processData: false,
async: true,
timeout: 10000,
success: function (data) {
// Get and display the result
$('.loader').hide();
$('#result').fadeIn(600);
$('#result').text(' Result: ' + data);
console.log('Success!');
},
});
});
});
})(jQuery);