Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cosmetic fixes in embeddings and core parameters UI #25

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 35 additions & 27 deletions nrtk_explorer/app/core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
r"""
Define your classes and create the instances that you need to expose
"""

import logging
from trame.app import get_server
from trame.ui.quasar import QLayout
Expand All @@ -12,6 +13,7 @@
from nrtk_explorer.app.embeddings import EmbeddingsApp
from nrtk_explorer.app.transforms import TransformsApp
from nrtk_explorer.app.applet import Applet
from pathlib import Path

import os

Expand All @@ -38,6 +40,11 @@ def image_id_to_result(image_id):
f"{DIR_NAME}/../../assets/OIRDS_v1_0/oirds_train.json",
]


def parse_dataset_dirs(datasets):
return [{"label": Path(ds).name, "value": ds} for ds in datasets]


# ---------------------------------------------------------
# Engine class
# ---------------------------------------------------------
Expand Down Expand Up @@ -178,33 +185,34 @@ def ui(self, *args, **kwargs):
with html.Div(
classes="column justify-center", style="padding:1rem"
):
with html.Div(classes="col"):
quasar.QSelect(
label="Dataset",
v_model=("current_dataset",),
options=(DATASET_DIRS,),
filled=True,
emit_value=True,
map_options=True,
)

quasar.QSeparator(inset=True)
quasar.QSeparator(inset=True)
html.P("Number of images:", classes="text-body2")
quasar.QSlider(
v_model=("num_images", 15),
min=(0,),
max=("num_images_max", 25),
disable=("num_images_disabled", True),
step=(1,),
label=True,
label_always=True,
)
quasar.QToggle(
v_model=("random_sampling", False),
label="Random selection",
left_label=True,
)
quasar.QSelect(
label="Dataset",
v_model=("current_dataset",),
options=(parse_dataset_dirs(DATASET_DIRS),),
filled=True,
emit_value=True,
map_options=True,
dense=True,
)

quasar.QSeparator(inset=True, spaced=True)
quasar.QSlider(
v_model=("num_images", 15),
min=(0,),
max=("num_images_max", 25),
disable=("num_images_disabled", True),
step=(1,),
)
html.P(
"{{num_images}}/{{num_images_max}} images",
classes="text-caption text-center",
)
quasar.QSeparator(inset=True, spaced=True)
quasar.QToggle(
v_model=("random_sampling", False),
dense=False,
label="Random selection",
)
self._embeddings_app.settings_widget()
self._transforms_app.settings_widget()

Expand Down
29 changes: 14 additions & 15 deletions nrtk_explorer/app/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ def settings_widget(self):
trame_server=self.server, classes="column justify-center", style="padding:1rem"
):
with html.Div(classes="col"):
with html.Div(classes="q-gutter-y-md"):
quasar.QBtnToggle(
v_model=("dimensionality", "3"),
toggler_color="primary",
flat=True,
spread=True,
options=(
[
{"label": "2D", "value": "2"},
{"label": "3D", "value": "3"},
],
),
)

quasar.QSelect(
label="Embeddings Model",
v_model=("current_model",),
Expand All @@ -195,22 +209,7 @@ def settings_widget(self):
map_options=True,
)

html.P("Dimensionality:", classes="text-body2")
with html.Div(classes="q-gutter-y-md"):
quasar.QBtnToggle(
v_model=("dimensionality", "3"),
toggler_color="primary",
flat=True,
spread=True,
options=(
[
{"label": "2D", "value": "2"},
{"label": "3D", "value": "3"},
],
),
)
with html.Div(classes="col"):
html.P("Method:", classes="text-body2")
with quasar.QTabs(
v_model="tab",
dense=True,
Expand Down
1 change: 1 addition & 0 deletions nrtk_explorer/app/transforms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
r"""
Define your classes and create the instances that you need to expose
"""

import logging
from typing import Dict

Expand Down
Loading