Skip to content

Commit

Permalink
fix(project-selection): use project name from meta instead of dirname (
Browse files Browse the repository at this point in the history
  • Loading branch information
Encord-davids authored Mar 7, 2023
1 parent 0eb8e02 commit 2d04677
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/encord_active/app/streamlit_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
is_project,
try_find_parent_project,
)
from encord_active.lib.common.utils import fetch_project_meta
from encord_active.lib.db.connection import DBConnection
from encord_active.lib.metrics.utils import MetricScope

Expand Down Expand Up @@ -60,14 +61,22 @@ def to_items(d: dict, parent_key: Optional[str] = None):
return [to_item(k, v, parent_key) for k, v in d.items()]


def get_project_name(path: Path):
try:
project_meta = fetch_project_meta(path)
return project_meta["project_title"]
except:
return path.name


def project_selector(path: Path):
if is_project(path):
projects = [path]
else:
parent_project = try_find_parent_project(path)
projects = [parent_project] if parent_project else find_child_projects(path)

return st.selectbox("Choose Project", projects, format_func=lambda path: path.name)
return st.selectbox("Choose Project", projects, format_func=get_project_name)


def main(target: str):
Expand Down

0 comments on commit 2d04677

Please sign in to comment.