Skip to main content

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

pip install tfjsa

Run and open in web browser

python -m tfjsa.run
or
python -m tfjsa.run silent

Go to http://localhost:5007

When 'silent' is passed, tfjsa will not open browser automatically

Run as a desktop application

python -m tfjsa.gui

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/

Metadata

Release files for tfjsa 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tfjsa 0.0.4
File Size Uploaded Provenance
tfjsa-0.0.4.tar.gz 118.7 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tfjsa 0.0.4
File Interpreter ABI Platform
tfjsa-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 237.3 MB

Release files / tfjsa-0.0.4.tar.gz

Download URL tfjsa-0.0.4.tar.gz
Size 118.7 MB
Tags Source
SHA-256 checksum
How to use checksums
37229ffca844db8669b3cff5c6e358642d92b011349c635d8a2f75748c9880e4
BLAKE2b-256 checksum
How to use checksums
a84907d1628f2acb54d8201332907ba245c6e3d04966828fe64b17ad0a04791f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release files / tfjsa-0.0.4-py3-none-any.whl

Download URL tfjsa-0.0.4-py3-none-any.whl
Size 118.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
65b2cd521f36f0b8bbbb57c8f4ebb15f9bcc0d4abba0a10cf9ddb40c602209c6
BLAKE2b-256 checksum
How to use checksums
bbecf35c7fc99e48ef2fd9f486532688fd665f81304fb42f0a109471adb956ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Security for tfjsa 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page