notbulubula commited on
Commit
6322afe
1 Parent(s): fc248a4
Files changed (2) hide show
  1. app.py +12 -8
  2. utils.py +23 -1
app.py CHANGED
@@ -2,9 +2,9 @@ import streamlit as st
2
  import wandb
3
  import pandas as pd
4
  import os
5
- import matplotlib.pyplot as plt
6
 
7
- from utils import fetch_runs_to_df
8
 
9
  # Access the API key from the environment variable
10
  wandb_api_key = os.getenv('WANDB_API_KEY')
@@ -63,9 +63,13 @@ if tag_filter:
63
  st.dataframe(df)
64
 
65
  # Display details of selected run
66
- selected_run_id = st.selectbox("Select a Run ID to see details", df["ID"].tolist() if not df.empty else [])
67
- if selected_run_id:
68
- selected_run = api.run(f"{projects[selected_project]['entity']}/{projects[selected_project]['project']}/{selected_run_id}")
69
- run_df = selected_run.history()
70
- st.write(f"Details for run: {selected_run.name}")
71
- st.dataframe(run_df)
 
 
 
 
 
2
  import wandb
3
  import pandas as pd
4
  import os
5
+ # import matplotlib.pyplot as plt
6
 
7
+ from utils import fetch_runs_to_df, fetch_run
8
 
9
  # Access the API key from the environment variable
10
  wandb_api_key = os.getenv('WANDB_API_KEY')
 
63
  st.dataframe(df)
64
 
65
  # Display details of selected run
66
+ if not df.empty:
67
+ selected_run_id = st.selectbox("Select a Run ID to see details", df["ID"].tolist())
68
+
69
+ run = fetch_run(api, projects, selected_project, selected_run_id)
70
+ if run:
71
+ run_df = run.history()
72
+ st.write(f"Details for run: {run.name}")
73
+ st.dataframe(run_df)
74
+ else:
75
+ st.warning("No runs available to select.")
utils.py CHANGED
@@ -1,9 +1,10 @@
1
  import streamlit as st
2
  import pandas as pd
 
3
 
4
  def fetch_runs_to_df(api, projects, selected_project):
5
  data = []
6
-
7
  if selected_project == "All":
8
  # return all runs from all projects
9
  for project_name, details in projects.items():
@@ -36,3 +37,24 @@ def fetch_runs_to_df(api, projects, selected_project):
36
  df = pd.DataFrame(data)
37
 
38
  return df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import pandas as pd
3
+ import wandb
4
 
5
  def fetch_runs_to_df(api, projects, selected_project):
6
  data = []
7
+
8
  if selected_project == "All":
9
  # return all runs from all projects
10
  for project_name, details in projects.items():
 
37
  df = pd.DataFrame(data)
38
 
39
  return df
40
+
41
+ def fetch_run(api, projects, selected_project, selected_run_id):
42
+ # Fetch run details based on the selected project
43
+ if selected_project == "All":
44
+ # Find the project for the selected run_id
45
+ for project_name, details in projects.items():
46
+ entity = details["entity"]
47
+ project = details["project"]
48
+ try:
49
+ run = api.run(f"{entity}/{project}/{selected_run_id}")
50
+ break
51
+ except wandb.errors.CommError:
52
+ continue
53
+ else:
54
+ st.error(f"Run ID {selected_run_id} not found in any project.")
55
+ else:
56
+ entity = projects[selected_project]["entity"]
57
+ project = projects[selected_project]["project"]
58
+ run = api.run(f"{entity}/{project}/{selected_run_id}")
59
+
60
+ return run