Hi
Can I pass an additional argument that is not an input in a Button.click?
something like:
gr.clickbtn.click(fn=myfunction(aditional_argument
)
Thank you for your great support and for the developers for making Gradio!
Hi
Can I pass an additional argument that is not an input in a Button.click?
something like:
gr.clickbtn.click(fn=myfunction(aditional_argument
)
Thank you for your great support and for the developers for making Gradio!
Hi @LittleWing ! Unfortunately, click
does not support arbitrary **kwargs. What are you trying to accomplish? There might be another way!
Hi @freddyaboulton Thanks for the quick reply!
I’ll try to explain,
I’m trying to write a code that connects to various switches (Networking) in my organization
I’m sending an api requests via the requests
library.
I have 2 buttons:
lets say a user pressed button number 1 for switch x, the code will send a login api request which grabs the cookie for switch x
if he will then press button number 2 to upgrade switch x the code will send another login api request
resulting with a new cookie, which I don’t want
Because the Button.click
binds one function per button I couldn’t find a way to bypass that there wont be a new request for every button.
Thanks
Hi @LittleWing ! Sorry it took me a while to get back to you.
Can you use a gr.Variable/gr.State (State In Blocks) to keep track of whether the first button is clicked before the second one?
Hi,
Thank you for the reply and support!
Its certainly a valid option to try! - I’ll give it a shot! , I will update if new issues arise
Thank you so much @freddyaboulton