Queries regarding Save option - Webcam - Multi-Input

Content

I’ve built a simple gradio app for image-to-image models. The input file is passed via upload or webcam. The output is shown using the gr.Galllery component. The model is control-net. The input image is first processed with a canny edge and produces a canny map. And that is further passes to control-net.

Qn 1. Save option

As mentioned, I’m using the Gallery component and so the output can be more than one sample. Unlike the Image component, the Gallery doesn’t have any download button. I’ve requested an FR on that. However, is there any way a workaround can be implemented with Gradio? Any demo app? The AUTOMATIC111 also uses gr.Gradio component, and has the following options. Though I didn’t dive to source code, wondering if it’s possible with current Gradio APIs.

Qn 2. Webcam

It’s been reported #3642. It’s weird that such common functionality is missing. However, AUTOMATIC111 provides the upload and webcam but this issue doesn’t appear in their gradio app. I wonder why?

Multi-Input

As mentioned, the image-to-image model takes one input image, passes it to the canny method to the canny map, and that canny map further passes to the control net and results in an image output. Now, as the canny map can be controlled by its low and high threshold, and in our case, the control net’s output depends on the canny map, I need to tweak the canny map and if it looks ok, only then I like to pass it to controlnet model.

So, in normal cases, I may do

inputs = gradio.Image() 
outputs = gradio.Image()

but we want to do as follows,

inputs = gradio.Image()
middle_input = gradio.Image()
output = gradio.Image()

I may treat the middle input as another output but I like to tweak it as it is the output of the canny method. If you know any example code (gradio app), could you please suggest?