replaced local files with urls to images (#965)

This commit is contained in:
Abubakar Abid 2022-04-08 07:35:55 -07:00 committed by GitHub
parent dc6175a21d
commit c19042ee62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -7,8 +7,15 @@ import gradio as gr
def fake_gan(*args): def fake_gan(*args):
time.sleep(2) time.sleep(1)
return "demo/fake_gan/fake" + str(random.randint(1, 2)) + ".png" image = random.choice([
"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
"https://images.unsplash.com/photo-1554151228-14d9def656e4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=386&q=80",
"https://images.unsplash.com/photo-1542909168-82c3e7fdca5c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8aHVtYW4lMjBmYWNlfGVufDB8fDB8fA%3D%3D&w=1000&q=80",
"https://images.unsplash.com/photo-1546456073-92b9f0a8d413?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80",
"https://images.unsplash.com/photo-1601412436009-d964bd02edbc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=464&q=80",
])
return image
demo = gr.Interface( demo = gr.Interface(
@ -21,6 +28,8 @@ demo = gr.Interface(
gr.Number(label="Respacing"), gr.Number(label="Respacing"),
], ],
outputs=gr.Image(label="Generated Image"), outputs=gr.Image(label="Generated Image"),
title="FD-GAN",
description="This is a fake demo of a GAN. In reality, the images are randomly chosen from Unsplash.",
) )
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -45,7 +45,7 @@
</script> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>
<title>Gradio</title> <title>Gradio</title>
<script type="module" crossorigin src="./assets/index.5ea27806.js"></script> <script type="module" crossorigin src="./assets/index.43c561e9.js"></script>
<link rel="stylesheet" href="./assets/index.4f55c05a.css"> <link rel="stylesheet" href="./assets/index.4f55c05a.css">
</head> </head>