burtenshaw HF Staff commited on
Commit
2b02c75
·
1 Parent(s): 90f87ea

first commit

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This demo needs to be run from the repo folder.
2
+ # python demo/fake_gan/run.py
3
+
4
+ import gradio as gr
5
+
6
+
7
+ def url_query_params(request: gr.Request) -> dict:
8
+ """Extract image urls from the query parameters."""
9
+ image_urls = []
10
+ for param in request.query_params:
11
+ if param.startswith("img"):
12
+ image_urls.append(request.query_params[param])
13
+ return image_urls
14
+
15
+
16
+ with gr.Blocks() as demo:
17
+ gallery = gr.Gallery(
18
+ label="Images",
19
+ show_label=False,
20
+ elem_id="gallery",
21
+ columns=[3],
22
+ rows=[1],
23
+ object_fit="contain",
24
+ height="auto",
25
+ )
26
+ demo.load(url_query_params, None, gallery)
27
+
28
+
29
+ if __name__ == "__main__":
30
+ demo.launch()