From 0982a453c30bf409fbe1972386c0323a113a3504 Mon Sep 17 00:00:00 2001 From: Tom Zayats Date: Tue, 10 Dec 2024 09:33:49 -0800 Subject: [PATCH] fmt --- journeys/evaluation.py | 15 +++++++-------- journeys/iteration.py | 8 ++++---- .../snowflake_utils/snowflake_connector.py | 1 - 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/journeys/evaluation.py b/journeys/evaluation.py index 39063291..a77987a2 100644 --- a/journeys/evaluation.py +++ b/journeys/evaluation.py @@ -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 ( @@ -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 @@ -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. @@ -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"] @@ -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 = "" diff --git a/journeys/iteration.py b/journeys/iteration.py index dab201d3..151c1248 100644 --- a/journeys/iteration.py +++ b/journeys/iteration.py @@ -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( diff --git a/semantic_model_generator/snowflake_utils/snowflake_connector.py b/semantic_model_generator/snowflake_utils/snowflake_connector.py index 85dbf1fb..f775ea15 100644 --- a/semantic_model_generator/snowflake_utils/snowflake_connector.py +++ b/semantic_model_generator/snowflake_utils/snowflake_connector.py @@ -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