Skip to main content

tfjs(Tensorflow js)-based Flask web apps.

Project description

About

This repo can be a good starting point for building your own tfjs (tensorflow-js)-based web applicaitons.
The original project is developed for ASP.Net MVC (http://zhangys.org.cn/DeepLearning). Now I rewrite it as a Flask web app.

We provide 5 apps:

  1. General image classification based on a pre-trained mobilenet model on imagenet.
  1. Object detection trained on COCO
  1. Style transfer. Provided by Reiichiro Nakano (https://github.com/reiinakano/arbitrary-image-stylization-tfjs)
  1. A binary classifier for judging fundus image quality.
  1. A plant disease classifier trained on PlantVillage dataset (doi: 10.17632/tywbtsjrjv)

Install & Run

pip install tfjsa

python -m tfjsa.run

Go to http://localhost:5007

Guide on re-development or extended development

If you want to re-develop on this repo or deploy to other framework. You might want to revise the following points.

  1. This repo use Jinja2 template language to write "layout.html". You may need to change to other server-side template languages, e.g., php, C# Razor, etc.

  2. To follow Flask practice, we have moved all static stuff (images, models, scripts, etc.) to the static folder. You may want to relocate these stuff if you deploy to other frameworks. As follows.

For the Image Classification app, you may need to revise static stuff path

`const MOBILENET_MODEL_PATH = 'static/Mobilenet/shards/model.json';`

`<img style="display: none" id="cat" src="static/Mobilenet/cat.jpg" width=224 height=224 />`

For the Object Detection app,

`<script src="static/SSD/coco-ssd.js" type="text/javascript"></script>`
`img.src = "static/Mobilenet/cat.jpg";`
coco-ssd.js: "static/SSD/shards/model.json"

For Style Transfer app,

  Modify the bundle.js. Change "saved_model_xxx" to "static/styletransfer/saved_model_xxx"
  `element.src = 'static/styletransfer/images/' + selectedValue + '.jpg';`

For Fundus Image Qualifier app,

`const MOBILENET_MODEL_PATH =
    '/Assets/DNNs/Mobilenet_F2/model.json';`
`<td><a target="_blank" href="static/Mobilenet_F2/model.json">model.json</a></td>`
`src="static/Mobilenet_F2/fundus.png"`

For Leaf app,

`<td><a target="_blank" href="static/Mobilenet_leaf/model.json">model.json</a></td>`

`src="static/Mobilenet_Leaf/tomato_leaf.jpg"`

Run directly from source

  1. git clone https://github.com/zhangys11/tfjs-app.git
  2. cd tfjs-app/tfjsa
  3. python run.py
  4. Go to http://localhost:5007/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tfjsa-0.0.2.tar.gz (118.6 MB view details)

Uploaded Source

Built Distribution

tfjsa-0.0.2-py3-none-any.whl (119.2 MB view details)

Uploaded Python 3

File details

Details for the file tfjsa-0.0.2.tar.gz.

File metadata

  • Download URL: tfjsa-0.0.2.tar.gz
  • Upload date:
  • Size: 118.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/1.5.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for tfjsa-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c6a3506bfd5ea4f185e88d810c0418ba0e5a5fd45f8a09e56e5d6a712089dacb
MD5 48adb8e47d1eecbf474ec1c6c1454f06
BLAKE2b-256 181ad415970c710bfbf11c3c48ee8fe0b4975145673deb0015478f87c4b20a3b

See more details on using hashes here.

File details

Details for the file tfjsa-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tfjsa-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 119.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/1.5.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for tfjsa-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b5fc50130b3304eabe290ba32da14baff843272e7864023137be7d146dee7e65
MD5 8b7486c1092b1ead6ccd6ce328802eab
BLAKE2b-256 082d054053d43be1f9b8ebb946048cdde09a0e2db1152984d462d967c605e30f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page