Spaces:
Build error
Build error
Ahsen Khaliq
commited on
Commit
•
d33f344
1
Parent(s):
d75884b
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random_face
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def mobileface(truncate, alpha):
|
5 |
+
engine = random_face.get_engine()
|
6 |
+
face = engine.get_random_face(truncate=truncate, alpha=alpha)
|
7 |
+
return face[:,:,::-1]
|
8 |
+
|
9 |
+
inputs = [
|
10 |
+
gr.inputs.Checkbox(label="Truncate"),
|
11 |
+
gr.inputs.Slider(minimum=0, maximum=1, step=None, default=0.5, label="Alpha")
|
12 |
+
|
13 |
+
]
|
14 |
+
|
15 |
+
outputs = gr.outputs.Image(type='numpy', label="Output Image")
|
16 |
+
|
17 |
+
title = "MobileStyleGAN"
|
18 |
+
description = "demo for MobileStylegan. To use it, simply click submit and optionally adjust alpha and truncation values. Read more below."
|
19 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2104.04767'>MobileStyleGAN: A Lightweight Convolutional Neural Network for High-Fidelity Image Synthesis</a> | <a href='https://github.com/bes-dev/MobileStyleGAN.pytorch'>Github Repo</a></p>"
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
gr.Interface(mobileface, inputs, outputs, title=title, description=description, article=article).launch()
|