Add streamlit helper#510
Conversation
c-bata
left a comment
There was a problem hiding this comment.
Thank you for your pull request!
I understand this PR is still WIP, but I left an early feedback comment.
| from ._streamlit_helper import render_trial_note # noqa | ||
| from ._streamlit_helper import render_user_attr_form_widgets # noqa |
There was a problem hiding this comment.
Could you add the optuna.streamlit package and put these functions in it? Then we can make streamlit as an optional dependency.
There was a problem hiding this comment.
OK. Does you mean I create directory "optuna-dashboard/streamlit" and put my code in this dir instead of "optuna-dashboard/optuna-dashboard/_streamlit_helper.py"?
|
You can test the work of this PR with the code below (This code is to test human_in_the_worker.py streamlit_worker.py Please run |
|
@knshnb Could you review this PR? |
c-bata
left a comment
There was a problem hiding this comment.
LGTM!
I created a simple application based on human-in-the-loop tutorial and confirmed that this PR works as expected.

https://gist.github.com/c-bata/ffcf52ca5c6fee5ec64e56eee451aabd
Contributor License Agreement
This repository (
optuna-dashboard) and Goptuna share common code.This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.
What does this implement/fix? Explain your changes.
This PR adds

streamlithelper for optuna-dashboard.Using this helper, users can render some widgets on streamlit with simple interface as the image below.
I added 3 streamlit helper functions and its unit tests.
render_trial_notestreamlitas a markdown format. It is helpful to use withsave_notefunction already in this repo (see:test_render_trial_note).render_user_attr_form_widgetsstreamlit. Submitted values to the forms are registered as eachtrial'suser_attrs. Is is helpful to use withregister_user_attr_form_widgetsfunction already in this repo (see:test_render_user_attr_form_widgets).render_objective_form_widgetsstreamlit. Submitted values to the forms are telled tooptunatrialobject. It is helpful to use withregister_objective_form_widgetsfunction already in this repo (see:test_render_objective_form_widgets)