PAIR-code / what-if-tool

Source code/webpage/demos for the What-If Tool
https://pair-code.github.io/what-if-tool
Apache License 2.0
892 stars 165 forks source link

Fix WIT backend calls when TensorBoard uses path_prefix option #191

Closed jameswex closed 2 years ago

jameswex commented 2 years ago

TensorBoard can be launched with a --path_prefix=[path] option to set a path prefix in the URL of tensorboard (useful when running in certain environments such as notebooks). WIT was using a hard-coded absolute path for its calls to the TensorBoard WIT backend, which would fail when TB was launched with a path_prefix.

This fix updates the WIT backend calls (these are only done when WIT is being used inside TensorBoard) to be relative paths, so the path_prefix is correctly used by the TensorBoard request manager. This fix also uses TB's addParams method universally instead of adding query params by hand.

Tested this fix both with a standard TB instance and one with a path_prefix set and ensured that WIT works correctly in both situations now.

Fixes #190 and https://github.com/tensorflow/tensorboard/issues/5472