Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide tensorboard button if tensorflow module is not installed #2347

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion kohya_gui/class_tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,20 @@ def stop_tensorboard(self):
return self.get_button_states(started=False)

def gradio_interface(self):
try:
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'

import tensorflow # Attempt to import tensorflow to check if it is installed

visibility = True

except ImportError:
self.log.error("Tensorboard is not installed, hiding the tensorboard button...")
visibility = False

with gr.Row():
button_start_tensorboard = gr.Button(
value="Start tensorboard", elem_id="myTensorButton"
value="Start tensorboard", elem_id="myTensorButton", visible=visibility
)
button_stop_tensorboard = gr.Button(
value="Stop tensorboard",
Expand Down