Skip to content

Commit

Permalink
improvements to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdai committed Sep 20, 2024
1 parent 0f7e2c4 commit 79e8181
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 19 deletions.
49 changes: 31 additions & 18 deletions arc_finetuning_st/streamlit/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,39 @@ def abort_solving() -> None:
key="prediction",
)

# metrics and past attempts
with st.container():
# metric
metric_value = st.session_state.get("metric_value")
st.metric(label="Passing", value=metric_value)
metric_col, attempts_history_col = st.columns(
[1, 7], vertical_alignment="top"
)
with metric_col:
metric_value = st.session_state.get("metric_value")
st.markdown(body="Passing")
st.markdown(body=f"# {metric_value}")

with attempts_history_col:
st.markdown(body="Past Attempts")
st.dataframe(
controller.attempts_history_df,
hide_index=True,
selection_mode="single-row",
on_select=controller.handle_workflow_run_selection,
column_order=(
"attempt #",
"passing",
"critique",
"rationale",
),
key="attempts_history_df",
use_container_width=True,
height=100,
)

with st.container():
# console
st.markdown(body="Critique of Attempt")
st.text_area(
label="Critique of prediction",
label="This critique is passed to the LLM to generate a new prediction.",
key="critique",
help=(
"An LLM was prompted to critique the prediction on why it might not fit the pattern. "
Expand All @@ -148,24 +173,12 @@ def abort_solving() -> None:
),
)

# controls
with st.container():
st.button(
"continue",
on_click=async_to_sync(controller.handle_prediction_click),
use_container_width=True,
disabled=st.session_state.get("disable_continue_button"),
key="continue_button",
)

st.dataframe(
controller.attempts_history_df,
hide_index=True,
selection_mode="single-row",
on_select=controller.handle_workflow_run_selection,
column_order=(
"attempt #",
"passing",
"rationale",
"critique",
),
key="attempts_history_df",
)
11 changes: 10 additions & 1 deletion arc_finetuning_st/streamlit/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,16 @@ def attempts_history_df(
"prediction": predictions,
}
)
return pd.DataFrame({})
return pd.DataFrame(
{
"attempt #": [],
"passing": [],
"rationale": [],
"critique": [],
# hidden from UI
"prediction": [],
}
)

def handle_workflow_run_selection(self) -> None:
selected_rows = (
Expand Down
2 changes: 2 additions & 0 deletions arc_finetuning_st/workflows/arc_task_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ async def reflection(self, ctx: Context, ev: EvaluationEvent) -> StopEvent:

# update states
latest_attempt.critique = critique
else:
latest_attempt.critique = "This predicted output is correct."

latest_attempt.passing = ev.passing
attempts[-1] = latest_attempt
Expand Down

0 comments on commit 79e8181

Please sign in to comment.