WIT embedded in custom web app

37 views
Skip to first unread message

hunterm...@gmail.com

unread,
Mar 23, 2020, 1:03:55 PM3/23/20
to What-If Tool
Hey there

I've built an application for our company that helps various departments make decision using different ML models. I can see a lot of places where the WIT would be immediately valuable for our teams and would love to incorporate it with the internal application i've built.  Have you seen or heard of anyone doing something like this?  Another option would be to just link to the notebooks hosted in GCP and have everything set up there, but it would be ideal to have it embedded somehow...

thanks for any feedback/advice

Hunter

James Wexler

unread,
Mar 23, 2020, 1:28:23 PM3/23/20
to hunterm...@gmail.com, What-If Tool
So far I'm not aware of anyone building WIT directly into a client-facing web app, with the exception of our own web demo code for the WIT website itself (although I'm hopeful for more of these uses in the future).

You could follow the same code we have for our WIT website demos to accomplish the same. Basically, we wrap the wit-dashboard Polymer element in a custom element that contains all the code for responding to events from WIT, such as for loading the test data and querying the model, and then passes the results to WIT. In our demos, that code loads the data from json and does the model inference directly in javascript using TensorFlow.js, but that code could instead make calls to a backend server to do that work.

Here is our simplest web demo example: https://github.com/PAIR-code/what-if-tool/blob/master/wit_dashboard/demo/wit-demo.html. But since WIT wasn't designed for this web-app-embedded use-case, the code to do this isn't as simple as it could be.

Things to notice:
- wit-dashboard is created with local=true and with placeholder, non-empty model-name and inference-address attributes.  This is so we can get javascript events to drive the data/model steps, instead of WIT itself trying to call into the TensorBoard backend for this information.
- all the addEventListener calls are for listening for events from WIT that require this wrapper to do something and then call back to WIT with results, either by setting a WIT attribute or calling a WIT function.
https://github.com/PAIR-code/what-if-tool/blob/master/wit_dashboard/demo/BUILD#L47 builds this demo into a static html file that could be put into a web app

Check it out and let me know what questions come up.

--
You received this message because you are subscribed to the Google Groups "What-If Tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to what-if-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/what-if-tool/0c3724f4-9f73-48ab-96de-b02c2618a905%40googlegroups.com.

Hunter Maxfield

unread,
Mar 24, 2020, 5:08:53 PM3/24/20
to James Wexler, What-If Tool
Awesome, thanks.  I'll give this a go and let you know if I have any questions. 

Hunter
Reply all
Reply to author
Forward
0 new messages