File size: 709 Bytes
2b02c75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This demo needs to be run from the repo folder.
# python demo/fake_gan/run.py

import gradio as gr


def url_query_params(request: gr.Request) -> dict:
    """Extract image urls from the query parameters."""
    image_urls = []
    for param in request.query_params:
        if param.startswith("img"):
            image_urls.append(request.query_params[param])
    return image_urls


with gr.Blocks() as demo:
    gallery = gr.Gallery(
        label="Images",
        show_label=False,
        elem_id="gallery",
        columns=[3],
        rows=[1],
        object_fit="contain",
        height="auto",
    )
    demo.load(url_query_params, None, gallery)


if __name__ == "__main__":
    demo.launch()