Spaces:
Runtime error
Runtime error
Logan Zoellner
commited on
Commit
•
712d57a
1
Parent(s):
e4a3446
initial commit
Browse files
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from asyncio import constants
|
2 |
+
import gradio as gr
|
3 |
+
import requests
|
4 |
+
import os
|
5 |
+
|
6 |
+
|
7 |
+
def generate_image(seed,psi):
|
8 |
+
iface = gr.Interface.load("spaces/hysts/StyleGAN-Human")
|
9 |
+
img=iface(seed,psi)
|
10 |
+
return img
|
11 |
+
|
12 |
+
def generate_model(img):
|
13 |
+
iface = gr.Interface.load("spaces/radames/PIFu-Clothed-Human-Digitization/tree/main")
|
14 |
+
model,file=iface(img)
|
15 |
+
return model,file
|
16 |
+
|
17 |
+
|
18 |
+
demo = gr.Blocks()
|
19 |
+
|
20 |
+
with demo:
|
21 |
+
gr.Markdown("<h1><center>StyleGan-Human + PIFu </center></h1>")
|
22 |
+
gr.Markdown(
|
23 |
+
"create a person and then generate a model from that person's image")
|
24 |
+
)
|
25 |
+
|
26 |
+
with gr.Row():
|
27 |
+
b0 = gr.Button("generate image")
|
28 |
+
b1 = gr.Button("generate model")
|
29 |
+
|
30 |
+
with gr.Row():
|
31 |
+
seed=gr.Number(default=0, label='Seed'),
|
32 |
+
psi=gr.Slider(0, 2, step=0.05, default=0.7, label='Truncation psi')
|
33 |
+
img = gr.Image(label="portrait",type="filepath", shape=(256,256))
|
34 |
+
model = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model"),
|
35 |
+
file= gr.File(label="Download 3D Model")
|
36 |
+
|
37 |
+
|
38 |
+
b0.click(generate_image,inputs=[seed,psi],outputs=img)
|
39 |
+
b1.click(generate_model, inputs=img, outputs=[model,file])
|
40 |
+
|
41 |
+
demo.launch(enable_queue=True, debug=True)
|