From 100a537238e60e4f143a058c4519889b95c012de Mon Sep 17 00:00:00 2001 From: AK391 Date: Tue, 13 Apr 2021 16:42:53 -0400 Subject: [PATCH 1/3] gradio demo --- demo.py | 23 +++++++++++++++++++++++ requirements.txt | 1 + 2 files changed, 24 insertions(+) create mode 100644 demo.py diff --git a/demo.py b/demo.py new file mode 100644 index 0000000..383e442 --- /dev/null +++ b/demo.py @@ -0,0 +1,23 @@ +import random_face +import gradio as gr + +def mobileface(truncate, alpha): + engine = random_face.get_engine() + face = engine.get_random_face(truncate=truncate, alpha=alpha) + return face[:,:,::-1] + +inputs = [ + gr.inputs.Checkbox(label="Truncate"), + gr.inputs.Slider(minimum=0, maximum=5, step=None, default=0.5, label="Alpha") + +] + +outputs = gr.outputs.Image(type='numpy', label="Output Image") + +title = "MobileStylegan" +description = "demo for MobileStylegan. To use it, simply click submit and optionally adjust alpha and truncation values. Read more below." +article = "

MobileStyleGAN: A Lightweight Convolutional Neural Network for High-Fidelity Image Synthesis | Github Repo

" + + + +gr.Interface(mobileface, inputs, outputs, title=title, description=description, article=article).launch() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 228a800..e54fc87 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ gdown==3.12.2 numpy opencv-python openvino +gradio From 1c2fe00873834e70a156e69cd700845162a7d2e7 Mon Sep 17 00:00:00 2001 From: AK391 Date: Tue, 13 Apr 2021 16:45:10 -0400 Subject: [PATCH 2/3] readme change --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 49b8a07..3eb8160 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ A simple python library for fast image generation of people who do not exist.

For more details, please refer to the [paper](https://arxiv.org/abs/2104.04767). +## Production-quality demos +* Gradio web demo [Gradio](https://gradio.app/hub/AK391/MobileStyleGAN.pytorch) + ## Requirements * Linux, Windows, MacOS From 0953f400c9ca5981cb5f9941e676e5e4dd00a81a Mon Sep 17 00:00:00 2001 From: AK391 Date: Tue, 13 Apr 2021 17:58:46 -0400 Subject: [PATCH 3/3] updates --- README.md | 5 ++--- demo.py => random_face/web_demo.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) rename demo.py => random_face/web_demo.py (93%) diff --git a/README.md b/README.md index 3eb8160..cb2177f 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,6 @@ A simple python library for fast image generation of people who do not exist.

For more details, please refer to the [paper](https://arxiv.org/abs/2104.04767). -## Production-quality demos -* Gradio web demo [Gradio](https://gradio.app/hub/AK391/MobileStyleGAN.pytorch) - ## Requirements * Linux, Windows, MacOS @@ -37,6 +34,8 @@ pip install . ```bash python -m random_face.demo ``` +## Web Demo +* Gradio web demo [Gradio](https://gradio.app/hub/AK391/MobileStyleGAN.pytorch) ## Example diff --git a/demo.py b/random_face/web_demo.py similarity index 93% rename from demo.py rename to random_face/web_demo.py index 383e442..84eb71e 100644 --- a/demo.py +++ b/random_face/web_demo.py @@ -8,7 +8,7 @@ def mobileface(truncate, alpha): inputs = [ gr.inputs.Checkbox(label="Truncate"), - gr.inputs.Slider(minimum=0, maximum=5, step=None, default=0.5, label="Alpha") + gr.inputs.Slider(minimum=0, maximum=1, step=None, default=0.5, label="Alpha") ]