GithubHelp home page GithubHelp logo

tonio73 / dash-to-react Goto Github PK

View Code? Open in Web Editor NEW
59.0 4.0 8.0 417 KB

Comparison of implementing a dashboard in Plotly Dash or in pure React.js using Plotly.js

Home Page: https://towardsdatascience.com/plotly-dash-or-react-js-plotly-js-b491b3615512

License: MIT License

Python 43.55% HTML 3.38% JavaScript 53.08%
plotly plotly-dash reactjs datavisualization

dash-to-react's Introduction

Plotly Dash or React.js + Plotly.js? A side by side comparison

This repository is showing a side by side example of implementing a dashboard with Plotly Dash or with React and React-Plotly. The test application is exposing a deep-learning model to perform inference on audio files. The selected model is YAMNet, an audio classifier based on Mobilenet and trained on AudioSet, a 2 million dataset of 10s audio samples.

This repository is the basis to a tutorial article posted on Medium: "Plotly Dash or React.js + Plotly.js? A side by side comparison"

Content

  • dash_version/: a Python application based on Plotly Dash and served by Flask development server
  • react_version/: a React browser application with a Web API server based on Flask

Install

Python environment

Python 3.7 and Pip are required. The favored install is through Conda.

Python dependencies are listed in the the file conda-env.yaml, they are mainly Dash, Tensorflow and Tensorflow-hub. If you do not use Conda, you may easily create a requirements.txt from the YAML file.

conda env create -f conda-env.yaml

There is a package shared by the two Flask application: yamnet_wrap. This package is loading and calling the YAMNet model and is performing a few statics on the returned scores.

To locally install the package:

pip install -e .

React environment

NPM and Yarn are pre-requisite.

To install the dependencies:

cd react_version
npm install

Sound samples

Sound samples are dowloaded into both application static directory:

  • dash_version/assets/samples/
  • react_version/public/samples/

An helper script is provided to populate these directories using some audio samples from Global Biodiversity Information Facility:

python ./download_samples.py

Run the applications

Run the Dash app in development

cd dash_version 
python dash_app.py

Open browser on http://localhost/8050

Run the React app

Run the API server

From a terminal:

cd react_version/api
python app.py

Check opening in a browser (or with curl) http://localhost:5000/infer?file=Panthera_pardus_S0962_05_short.mp3

Run the React app in development with Yarn

From a different terminal:

cd react_version
yarn start

dash-to-react's People

Contributors

tonio73 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.