ui-and-components
Launch and reason about Opyrator's Streamlit UI, schema-driven widgets, FileContent values, reusable output components, and custom UI hooks.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- ui-and-components
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Launch and reason about Opyrator's Streamlit UI, schema-driven widgets, FileContent values, reusable output components, and custom UI hooks.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/component-reference.md7.1 KB
- 参考文档references/troubleshooting.md6.0 KB
- 参考文档references/workflows.md9.9 KB
- 脚本scripts/schema_smoke.py11.1 KB
03 SKILL.md 正文
UI and Components
Use this sub-skill when the user asks how Opyrator renders an interactive Streamlit UI, how Pydantic schemas become widgets, how FileContent values move through uploads/downloads, or how to add custom input/output renderers.
Route here for
- Launching or embedding the Streamlit UI with
launch_ui(opyrator_path, port=8501)orrender_streamlit_ui(Opyrator(...)). - Predicting which Pydantic field shapes become text inputs, sliders, file uploaders, enums, dict editors, nested-object sections, or list editors.
- Designing schema-only UI behavior with
Field(...)metadata such astitle,description,default,example, ranges,max_length,mime_type, and enum types. - Handling
opyrator.components.types.FileContent, including upload validation, base64 round-tripping,as_bytes(),as_str(), and media previews/downloads. - Using reusable component outputs such as
ClassificationOutputandScoredLabel. - Adding
render_input_ui(streamlit, input_data)on an input model orrender_output_ui(streamlit[, input=...])on output models. - Troubleshooting Streamlit/protobuf compatibility, old Streamlit session-state imports, unsupported schema shapes, file media handling, and missing optional demo dependencies.
Do not handle here
- Function compatibility, callable import strings, CLI
call,export,deploy, or general command routing: use wrapping-and-cli. - FastAPI app creation, OpenAPI service behavior, request/response endpoint structure, or OpenAPI schema patching: use api-services.
- Root-level package installation and version pinning decisions that affect all workflows: start at the root skill router and the root troubleshooting guide.
Operating workflow
- Confirm that the callable already satisfies Opyrator's shared callable contract: one parameter named
inputtyped as a PydanticBaseModel, and a PydanticBaseModelor list of models as return type. For the shared contract and API consequences, route through api-services. - For UI launch choices, use workflows. Prefer
opyrator launch-ui module:function --port 8051for an interactive server, orrender_streamlit_ui(Opyrator(...))only inside a Streamlit script. - For schema-to-widget mapping, use component reference. Check the predicate order before changing a Pydantic field shape.
- For files and media outputs, use FileContent workflows and the FileContent reference.
- For custom renderers, use custom UI hook workflows. Keep fallback behavior explicit for output renderers that may fail.
- If UI import, launch, schema classification, or media rendering fails, use troubleshooting before modifying the callable.
Bundled helper
scripts/schema_smoke.py: safe deterministic smoke helper that builds a showcase-style Pydantic model, classifies its schema withopyrator.ui.schema_utils, verifiesFileContentround-tripping, and checks custom renderer discovery without launching Streamlit or opening a browser.
Run it from this sub-skill directory in an environment where Opyrator is installed:
python scripts/schema_smoke.py --json
Expected success signal: exit code 0, status: "ok", all expected field classifications present, file_round_trip.round_trip_bytes_match: true, and the hook summary matches the expected hook summary.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).