-
Notifications
You must be signed in to change notification settings - Fork 77
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
set_option problem #9
Comments
I want to reproduce this example: export const DisplayNode = new NodeBuilder("DisplayNode")
import { Node } from "@baklavajs/core"; export class MathNode extends Node {
} |
Hello @erwanito12 If I understood you right, you want to display the value from the slider on the result block, updating the string Then, that is not possible at the moment. (Nor do I see that feature in the roadmap.) The display option is on the initial block creation. And cannot be updated later on schema execution. But you can get the result from the result block and display it on the app, by using: if barfi_result:
st.write(barfi_result['Result-1']['block'].get_interface('Input 1')) |
Thank you @krish-adi for your detailed answer, you understood my request very well. my more general idea is to be able to add options to your library. I achieved this by modifying the files in the frontEnd folder and at option_builder.py. I want to be able to modify a canvas like I do with baklavajs. indeed the value cannot be updated within the framework of your library, it's a real shame that it greatly limits the use and ergonomics of your library. congratulations for your excellent work. |
with this script: from barfi import st_barfi, barfi_schemas, Block feed = Block(name='Feed') def feed_func(self):
feed.add_compute(feed_func) slider_block = Block(name='Slider') slider_block.add_input() slider_block.add_option(name='display-option', type='display',value='This is a Block with Slider option.') def slider_block_func(self): result = Block(name='Result') def result_func(self): result.set_option(name='ValueText',value='toto') |
hey erwanito12 would you mind to share your scripts? I like to play with this too as we got the same requirements. We like to build a block which could show a result image or maybe more |
@erwanito12 Sorry, I missed this. Could you send a PR with an example to test it? |
can i add a dialog box popup to add a form in the block |
I'm also looking forward for a way on how to update (rerender) a Display in the canvas Lovely and simple module/widget great work anyway |
hello, with this script I am trying to display the output of the slider block in a result block without result. what is wrong with my script? thanks in advance
from barfi import st_barfi, barfi_schemas, Block
import streamlit as st
slider_block = Block(name='Slider')
slider_block.add_input()
slider_block.add_output()
slider_block.add_option(name='display-option', type='display',value='This is a Block with Slider option.')
slider_block.add_option(name='slider-option-1', type='slider', min=0, max=10, value=2.5)
def slider_block_func(self):
input_1_value = self.get_interface(name='Input 1')
slider_block.add_compute(slider_block_func)
result = Block(name='Result')
result.add_input()
result.add_option(name='ValueText', type='display', value='toto')
def result_func(self):
in_1 = self.get_interface(name='Input 1')
self.set_option(name='ValueText',value=str(in_1))
result.add_compute(result_func)
compute_engine = st.checkbox('Activate barfi compute engine', value=True)
barfi_result = st_barfi(base_blocks=[ slider_block, result])
if barfi_result:
st.write(barfi_result)
The text was updated successfully, but these errors were encountered: