Spaces:
Running
Running
geekyrakshit
commited on
Commit
·
18b8750
1
Parent(s):
306b50d
update: evaluation app
Browse files
application_pages/evaluation_app.py
CHANGED
@@ -8,34 +8,39 @@ weave.init(project_name="guardrails-genie")
|
|
8 |
|
9 |
st.title(":material/monitoring: Evaluation")
|
10 |
|
11 |
-
if "
|
12 |
-
st.session_state.
|
13 |
-
if "
|
14 |
-
st.session_state.
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
visualize_in_app = st.sidebar.toggle("Visualize in app", value=False)
|
|
|
19 |
|
20 |
-
if uploaded_file is not None:
|
21 |
-
with st.expander("Dataset Preview"):
|
22 |
-
dataframe = pd.read_csv(uploaded_file)
|
23 |
data_list = dataframe.to_dict(orient="records")
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
st.session_state.ref = weave.publish(dataset)
|
28 |
-
st.write(
|
29 |
-
f"Dataset published at https://wandb.ai/{st.session_state.ref.entity}/{st.session_state.ref.project}/weave/objects/{st.session_state.ref.name}/versions/{st.session_state.ref._digest}"
|
30 |
-
)
|
31 |
-
|
32 |
-
if visualize_in_app:
|
33 |
-
st.dataframe(data_list)
|
34 |
-
# dataset = weave.ref("weave:///geekyrakshit/guardrails-genie/object/sample-dataset:RvdLm7KZ5KXFGcXUHWMGoJBWRVmdxiH6VgWu4cpsDHM").get()
|
35 |
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
st.write("Evaluation results will be displayed here.")
|
|
|
8 |
|
9 |
st.title(":material/monitoring: Evaluation")
|
10 |
|
11 |
+
if "uploaded_file" not in st.session_state:
|
12 |
+
st.session_state.uploaded_file = None
|
13 |
+
if "dataset_name" not in st.session_state:
|
14 |
+
st.session_state.dataset_name = ""
|
15 |
+
if "visualize_in_app" not in st.session_state:
|
16 |
+
st.session_state.visualize_in_app = False
|
17 |
+
if "dataset_ref" not in st.session_state:
|
18 |
+
st.session_state.dataset_ref = None
|
19 |
+
|
20 |
+
uploaded_file = st.sidebar.file_uploader(
|
21 |
+
"Upload the evaluation dataset as a CSV file", type="csv"
|
22 |
+
)
|
23 |
+
st.session_state.uploaded_file = uploaded_file
|
24 |
+
dataset_name = st.sidebar.text_input("Evaluation dataset name", value="")
|
25 |
+
st.session_state.dataset_name = dataset_name
|
26 |
visualize_in_app = st.sidebar.toggle("Visualize in app", value=False)
|
27 |
+
st.session_state.visualize_in_app = visualize_in_app
|
28 |
|
29 |
+
if st.session_state.uploaded_file is not None and st.session_state.dataset_name != "":
|
30 |
+
with st.expander("Evaluation Dataset Preview"):
|
31 |
+
dataframe = pd.read_csv(st.session_state.uploaded_file)
|
32 |
data_list = dataframe.to_dict(orient="records")
|
33 |
|
34 |
+
dataset = weave.Dataset(name=st.session_state.dataset_name, rows=data_list)
|
35 |
+
st.session_state.dataset_ref = weave.publish(dataset)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
entity = st.session_state.dataset_ref.entity
|
38 |
+
project = st.session_state.dataset_ref.project
|
39 |
+
dataset_name = st.session_state.dataset_name
|
40 |
+
digest = st.session_state.dataset_ref._digest
|
41 |
+
st.markdown(
|
42 |
+
f"Dataset published to [**Weave**](https://wandb.ai/{entity}/{project}/weave/objects/{dataset_name}/versions/{digest})"
|
43 |
+
)
|
44 |
|
45 |
+
if visualize_in_app:
|
46 |
+
st.dataframe(dataframe)
|
|