This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib, sys, os | |
def calculate_hash(args): | |
BUF_SIZE = 65536 | |
file_name = args[0] | |
if not os.path.isfile(file_name): | |
return "Not a file" | |
sha1 = hashlib.sha1() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let model; | |
const modelURL = 'http://localhost:5000/model'; | |
const preview = document.getElementById("preview"); | |
const predictButton = document.getElementById("predict"); | |
const clearButton = document.getElementById("clear"); | |
const numberOfFiles = document.getElementById("number-of-files"); | |
const fileInput = document.getElementById('file'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let model; | |
const modelURL = 'http://localhost:5000/model'; | |
const preview = document.getElementById("preview"); | |
const predictButton = document.getElementById("predict"); | |
const clearButton = document.getElementById("clear"); | |
const numberOfFiles = document.getElementById("number-of-files"); | |
const fileInput = document.getElementById('file'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<h1>TensorflowJS client side prediction</h1> | |
<h2>When you first time press predict it will take more time, for model to load</h2> | |
<main> | |
<input type="file" id="file" multiple> | |
<label for="file">Choose files</label> | |
<button type="submit">Predict</button> | |
<button type="submit">Clear</button> | |
<span></span> | |
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>TF JS example</title> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_cors import CORS | |
from flask import Flask, request, render_template, json, jsonify, send_from_directory | |
import json | |
import cv2 | |
import numpy as np | |
import io | |
app = Flask(__name__) | |
CORS(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let model; | |
const modelURL = 'http://localhost:5000/model'; | |
const preview = document.getElementById("preview"); | |
const predictButton = document.getElementById("predict"); | |
const clearButton = document.getElementById("clear"); | |
const numberOfFiles = document.getElementById("number-of-files"); | |
const fileInput = document.getElementById('file'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>TF JS example</title> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script> | |
<link rel="stylesheet" href="../static/frontend/styles.css"> | |
</head> | |
<body> | |
<h1 class="title">TensorflowJS client side prediction</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_cors import CORS | |
from flask import Flask, render_template | |
app = Flask(__name__) | |
CORS(app) | |
@app.route("/", methods=["GET"]) | |
def main(): | |
return render_template('index.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your training happens here | |
# Hundreds and hundreds of layers | |
# Stacked to create the greatest model ever | |
# don't forget saving to json format | |
import tensorflowjs as tfjs | |
tfjs.converters.save_keras_model(model, "model_js") |