text
stringlengths 0
93.6k
|
---|
},
|
form_layout=AccordionFormLayout(
|
sections=[
|
FormSection(name="General", fields=["name", "age", "mini_bio"], default_open=True),
|
FormSection(
|
name="HR",
|
fields=["office", "joined", "location", "resume_file", "metadata"],
|
default_open=True,
|
),
|
FormSection(name="Other", fields=["pets", "jobs"], default_open=True),
|
],
|
),
|
),
|
],
|
pt="1rem",
|
)
|
),
|
dmc.AppShellAside(
|
dmc.ScrollArea(
|
dmc.Text(
|
id=ids.form_dependent_id("output", AIO_ID, FORM_ID),
|
style={"whiteSpace": "pre-wrap"},
|
p="1rem 0.5rem",
|
),
|
),
|
),
|
],
|
aside={"width": 350},
|
),
|
)
|
@callback(
|
Output(ids.form_dependent_id("output", MATCH, MATCH), "children"),
|
Output(ModelForm.ids.errors(MATCH, MATCH), "data"),
|
Input(ModelForm.ids.main(MATCH, MATCH), "data"),
|
State(ModelForm.ids.model_store(MATCH, MATCH), "data"),
|
prevent_initial_call=True,
|
)
|
def display(form_data, model_name):
|
"""Display form data."""
|
children = dmc.Stack(
|
[
|
dmc.Text("Form data", mb="-0.5rem", fw=600),
|
dmc.Code(
|
json.dumps(form_data, indent=2),
|
),
|
]
|
)
|
errors = None
|
try:
|
model_cls = get_model_cls(model_name)
|
item = model_cls.model_validate(form_data)
|
children.children[1].children = item.model_dump_json(indent=2)
|
except ValidationError as e:
|
children.children.extend(
|
[
|
dmc.Text("Validation errors", mb="-0.5rem", fw=500, c="red"),
|
dmc.List(
|
[
|
dmc.ListItem(
|
[SEP.join([str(x) for x in error["loc"]]), f" : {error['msg']}, got {error['input']}"],
|
)
|
for error in e.errors()
|
],
|
size="sm",
|
c="red",
|
),
|
]
|
)
|
errors = None
|
errors = {SEP.join([str(x) for x in error["loc"]]): error["msg"] for error in e.errors()}
|
return children, errors
|
clientside_callback(
|
"""(isLightMode) => isLightMode ? 'light' : 'dark'""",
|
Output("mantine-provider", "forceColorScheme"),
|
Input("scheme-switch", "checked"),
|
prevent_initial_callback=True,
|
)
|
if __name__ == "__main__":
|
app.run_server(debug=True)
|
# <FILESEP>
|
import argparse
|
import copy
|
import pickle
|
import numpy as np
|
import torch
|
from agent.qvpo import QVPO
|
from agent.replay_memory import ReplayMemory, DiffusionMemory
|
from tensorboardX import SummaryWriter
|
import gym
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.