Code Monkey home page Code Monkey logo

d3-flask-playground's Introduction

d3-flask-playground

simple experiment visualizing python generated data in D3

Start Both Components With Docker Compose

If you have Docker Compose installed on your machine, you can quickly setup the backend and frontend in development mode, as described below, with one command:

$ docker-compose up

Then, navigate your browser to http://localhost:8080.

Backend Setup (Python, Flask)

On Windows, activate virtual environment with source venv/Scripts/activate.

Initial Setup:

python3.8 -m venv venv
source venv/bin/activate
pip install Flask Flask-Cors
pip install waitress
pip install numpy

Code from https://testdriven.io/blog/developing-a-single-page-app-with-flask-and-vuejs/

Use waitress as a production WSGI server.

Start:

  • development server: FLASK_ENV=development FLASK_APP=app:app flask run
  • production server: waitress-serve --port=5000 app:app
  • browse to http://127.0.0.1:5000/data/12

Frontend Setup (TypeScript, D3)

Initial Setup:

Steps to Run:

  • Setup dependencies yarn install
  • (optionally) change BACKEND_URL in src/index.ts (default: same host as frontend web server)
  • Start development server npm start and browse to http://localhost:8080/
  • Build for production server npm run build and copy dist folder

Further ToDos

Benefits and Limitations

This architecture seems especially useful ...

  • for independent work on VIS and ML. (Each may use their favorite frameworks or even connect a finished visualization prototype to a trained model.)
  • if the python does not need to keep track of user state (i.e., each request provides all context information)
  • if the initiative starts from the user (cp. Sperrle et al., 2020).

Some aspects of Visual Analytics will need special attention:

  • training data for ML models is provided interactively via the frontend, esp. active learning (should work if inputs are validated).
  • machine learning process taking the initiative to ask the human (cp. Sperrle et al., 2020)
  • provide progressive updates while machine learning is still in progress (cp. Stolper et al., 2014).

Acknowledgments

This work was partly funded by the Austrian Research Promotion Agency (FFG): grant #866855 via ReMoCap-Lab.

d3-flask-playground's People

Contributors

alex-rind avatar dependabot[bot] avatar steve-kasica avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

steve-kasica

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.