Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gan demo fix #965

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed demo/fake_gan/fake1.png
Binary file not shown.
Binary file removed demo/fake_gan/fake2.png
Binary file not shown.
13 changes: 11 additions & 2 deletions demo/fake_gan/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@


def fake_gan(*args):
time.sleep(2)
return "demo/fake_gan/fake" + str(random.randint(1, 2)) + ".png"
time.sleep(1)
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(
Expand All @@ -21,6 +28,8 @@ def fake_gan(*args):
gr.Number(label="Respacing"),
],
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__":
Expand Down
2 changes: 1 addition & 1 deletion gradio/templates/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>
<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">
</head>

Expand Down