Skip to content

Instantly share code, notes, and snippets.

View rizalespe's full-sized avatar
🏠
Working from home

Rizal Setya Perdana rizalespe

🏠
Working from home
View GitHub Profile
<body>
<input type='file' onchange="resnetPredict(this);" />
</body>
<script>
function resnetPredict(input) {
if (input.files && input.files[0]) {
$('#images_show').show();
var reader = new FileReader();
reader.onload = function (e) {
# importing all required package library
from keras.applications import ResNet50
from keras.preprocessing.image import img_to_array
from keras.applications import imagenet_utils
import numpy as np
# A class for image prediction based on ResNet pre-trained model
class ResNetPredict:
def __init__(self):
# importing all required library
import flask
import io
from flask_cors import CORS
from PIL import Image
from ResNetPredict import ResNetPredict
app = flask.Flask(__name__)
# Cross Origin Resource Sharing (CORS), making the URL accessible from cross-origin AJAX