diff --git a/public/plugins/bioengine-test-run.imjoy.html b/public/plugins/bioengine-test-run.imjoy.html new file mode 100644 index 00000000..d8e52139 --- /dev/null +++ b/public/plugins/bioengine-test-run.imjoy.html @@ -0,0 +1,639 @@ + +The panel for upload the image file. + + + +{ + "name": "BioEngine Model Runner", + "type": "window", + "tags": [], + "ui": "", + "version": "0.1.0", + "cover": "", + "description": "[TODO: describe this plugin with one sentence.]", + "icon": "extension", + "inputs": null, + "outputs": null, + "api_version": "0.1.8", + "env": "", + "permissions": [], + "requirements": [ + "https://cdn.tailwindcss.com", + "https://cdn.jsdelivr.net/npm/imjoy-rpc@0.5.6/dist/hypha-rpc-websocket.min.js" + ], + "dependencies": [] +} + + + + + +
+

Load an image file:

+

Example formats: PNG, JPG or TIFF

+

TODO: display expected tensor info

+
+ No file selected. + + +
+ + +

or you may load the image from an URL.

+

A test image is provided for this model. Click the Load button to run the model on the provided test image or provide the url to your own test image.

+

The URL to OME-Zarr are supported.

+
+ + +
+
+

+ +
+ +

Input axes (optional, for example yxzc):

+

+

More documentation about expected axes in the documentation page.

+ + +
+ +

+
+ + +
+

+ +
+ +
+ + + +
+
+
+ + + +{ + "name": "mi-core", + "type": "web-python", + "tags": [], + "flags": [], + "ui": "", + "version": "0.1.0", + "cover": "", + "description": "Connect to the bioengine server, and execute operations.", + "icon": "extension", + "inputs": null, + "outputs": null, + "api_version": "0.1.8", + "env": "", + "permissions": [], + "requirements": ["imageio", "xarray"], + "dependencies": [] +} + + + + diff --git a/src/components/ResourceItemInfo.vue b/src/components/ResourceItemInfo.vue index 051a4ec8..5791ac3b 100644 --- a/src/components/ResourceItemInfo.vue +++ b/src/components/ResourceItemInfo.vue @@ -102,6 +102,14 @@ >+ click here to see the full documentation +
+ +

Training Data

@@ -228,6 +236,9 @@ export default { this.$forceUpdate(); }); } + this.getInterfaceDocs(this.resourceItem).then(() => { + this.$forceUpdate(); + }); }, computed: { runButtonContext: function() { @@ -341,6 +352,62 @@ export default { .join("\n").length; } } + }, + async getInterfaceDocs(resourceItem) { + const url = + window.location.origin + "/plugins/bioengine-test-run.imjoy.html"; + const docs = ` +## Quick model testing with your own data +Through clicking "Test the model" you are able to do a quick test with your own data. + + +\`\`\`js +api.createWindow({ + src: "${url}", + window_id: "test-run-form", + data: { + id: "${resourceItem.id}", + input_window_id: "image_input_window", + output_window_id: "image_output_window" + }} + ) +\`\`\` + + +
+
+
+
+
+ `; + resourceItem.interfaceDocs = docs; } } }; diff --git a/src/imjoy-run-buttons.js b/src/imjoy-run-buttons.js index 2285d657..ec7c4a17 100644 --- a/src/imjoy-run-buttons.js +++ b/src/imjoy-run-buttons.js @@ -428,7 +428,9 @@ function execute(preElm, mode) { runCode(mode, preElm.pluginConfig, code).finally(() => { loader.style.display = "none"; const runBtn = preElm.querySelector(".docsify-run-button"); - if (runBtn) runBtn.innerHTML = i18n.runButtonText; + if (runBtn) + runBtn.innerHTML = + preElm.pluginConfig.run_button_text || i18n.runButtonText; const outputElem = document.getElementById("output_" + id); if (outputElem && outputElem.children.length > 0) outputFullscreenElm.style.display = "inline-block"; @@ -438,7 +440,9 @@ function execute(preElm, mode) { runCode(mode, preElm.pluginConfig, code).finally(() => { loader.style.display = "none"; const runBtn = preElm.querySelector(".docsify-run-button"); - if (runBtn) runBtn.innerHTML = i18n.runButtonText; + if (runBtn) + runBtn.innerHTML = + preElm.pluginConfig.run_button_text || i18n.runButtonText; }); }); } @@ -449,6 +453,12 @@ function execute(preElm, mode) { showCodeBtn.style.display = "block"; } } + + if (preElm.pluginConfig.minimal_ui) { + showCodeBtn.style.display = "none"; + const progressBar = preElm.querySelector(".docsify-progressbar"); + progressBar.style.display = "none"; + } document.addEventListener("fullscreenchange", function(e) { const fullScreenMode = document.fullScreen || @@ -598,6 +608,19 @@ export function initializeRunButtons(rootElement, runButtonContext) { execute(elm, mode); delete elm.pluginConfig.startup_mode; } + const editBtn = elm.querySelector(".docsify-edit-button"); + const runBtn = elm.querySelector(".docsify-run-button"); + const loader = elm.querySelector(".docsify-loader"); + if (elm.pluginConfig.minimal_ui) { + editBtn.style.display = "none"; + showCodeBtn.style.display = "none"; + runBtn.style.width = "99%"; + loader.style.position = "absolute"; + loader.style.left = "49%"; + } + if (runBtn) + runBtn.innerHTML = + elm.pluginConfig.run_button_text || i18n.runButtonText; } catch (e) { console.error(e); }