Hey everyone. I’m using a jupyter lab notebook and I’d like it if after getting the inputs from the user (me), the gradio app would close the server port and even better, disappear.
So for example, a user would write in jupyter:
start_process()
and a gui would appear right below the cell with some sliders or whatever, asking for the user input. Then the user would click the “submit” button, and the user interface would disappear, the server port would close, and the real process would begin, with some parameters set by the aforementioned sliders.
I’ve tried something like this:
with gr.Blocks() as demo:
def process_and_close(*args):
demo.clear()
demo.close()
# do stuff with args
a = gr.Slider(label="Variable a")
btn = gr.Button("Submit")
btn.click(fn=process_and_close, inputs=a, outputs=None)
demo.launch()
but it just stops working, it doesn’t disappear. I think it might close the server, but the gui stays there.