Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-tzayats committed Dec 10, 2024
1 parent 9505f1b commit 0982a45
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
15 changes: 7 additions & 8 deletions journeys/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
from app_utils.shared_utils import (
get_snowflake_connection,
schema_selector_container,
set_sit_query_tag,
table_selector_container,
validate_table_exist,
validate_table_schema,
set_sit_query_tag,
)
from semantic_model_generator.data_processing.proto_utils import proto_to_yaml
from semantic_model_generator.snowflake_utils.snowflake_connector import (
Expand Down Expand Up @@ -261,7 +261,7 @@ def result_comparisons() -> None:
status_text.text(
f"Analyst and Gold Results Compared ✅ (Time taken: {elapsed_time:.2f} seconds)"
)
#compute accuracy
# compute accuracy
st.session_state["eval_accuracy"] = (frame["CORRECT"].sum() / len(frame)) * 100
st.session_state["total_eval_frame"] = frame

Expand Down Expand Up @@ -293,6 +293,7 @@ def write_eval_results(frame: pd.DataFrame) -> None:
)
st.write("Evaluation results stored in the database ✅")


def _match_series(analyst_frame: pd.DataFrame, gold_series: pd.Series) -> str | None:
"""Determine which result frame column name matches the gold series.
Expand Down Expand Up @@ -608,13 +609,12 @@ def evaluation_mode_show() -> None:
visualize_eval_results(st.session_state["total_eval_frame"])



def run_evaluation() -> None:
set_sit_query_tag(
get_snowflake_connection(),
vendor="",
action="evaluation_run",
)
get_snowflake_connection(),
vendor="",
action="evaluation_run",
)
current_hash = generate_hash(st.session_state["working_yml"])
model_changed_test = ("semantic_model_hash" in st.session_state) and (
current_hash != st.session_state["semantic_model_hash"]
Expand All @@ -636,7 +636,6 @@ def run_evaluation() -> None:
st.write("Evaluation complete ✅")



@st.cache_resource(show_spinner=False)
def generate_hash(input_object: Any) -> str:
output_hash = ""
Expand Down
8 changes: 4 additions & 4 deletions journeys/iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,10 @@ def show() -> None:
return_home_button()
with mode:
st.session_state["app_mode"] = st.selectbox(
label="App Mode",
label_visibility="collapsed",
options=["Chat", "Evaluation", "Preview YAML"],
)
label="App Mode",
label_visibility="collapsed",
options=["Chat", "Evaluation", "Preview YAML"],
)
if "yaml" not in st.session_state:
# Only proceed to download the YAML from stage if we don't have one from the builder flow.
yaml = download_yaml(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import concurrent.futures
from collections import defaultdict
from contextlib import contextmanager
from textwrap import dedent
from typing import Any, Dict, Generator, List, Optional, TypeVar, Union

import pandas as pd
Expand Down

0 comments on commit 0982a45

Please sign in to comment.