Spaces:
Runtime error
Runtime error
updated requirements
Browse files
app.py
CHANGED
@@ -30,10 +30,73 @@ def generate_view(source_img, elevation, azimuth, camera_distance, num_inference
|
|
30 |
return images[0]
|
31 |
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
return images[0]
|
31 |
|
32 |
|
33 |
+
def app():
|
34 |
+
with gr.Blocks():
|
35 |
+
with gr.Row():
|
36 |
+
with gr.Column():
|
37 |
+
image = gr.Image(type="pil", value="https://huggingface.co/spaces/p4vv37/Stable-zero123/resolve/main/images/bottle.png?download=true")
|
38 |
+
|
39 |
+
elevation = gr.Number(label="elevation", value=0.)
|
40 |
+
azimuth = gr.Number(label="azimuth", value=45.)
|
41 |
+
camera_distance = gr.Number(label="camera_distance", value=1.2)
|
42 |
+
num_inference_steps = gr.Slider(
|
43 |
+
label="Inference Steps",
|
44 |
+
minimum=0,
|
45 |
+
maximum=100,
|
46 |
+
step=1,
|
47 |
+
value=20,
|
48 |
+
)
|
49 |
+
|
50 |
+
generate = gr.Button(value="Generate")
|
51 |
+
|
52 |
+
with gr.Column():
|
53 |
+
output = gr.Image(type="pil",label="Output", width=256, height=256)
|
54 |
+
|
55 |
+
generate.click(
|
56 |
+
fn=generate_view,
|
57 |
+
inputs=[
|
58 |
+
image,
|
59 |
+
elevation,
|
60 |
+
azimuth,
|
61 |
+
camera_distance,
|
62 |
+
num_inference_steps,
|
63 |
+
],
|
64 |
+
outputs=[output],
|
65 |
+
)
|
66 |
+
|
67 |
+
gr.Examples(
|
68 |
+
examples=[
|
69 |
+
[
|
70 |
+
"images/bottle.png",
|
71 |
+
0.,
|
72 |
+
45.,
|
73 |
+
1.2,
|
74 |
+
40,
|
75 |
+
]
|
76 |
+
],
|
77 |
+
fn=generate_view,
|
78 |
+
inputs=[
|
79 |
+
image,
|
80 |
+
elevation,
|
81 |
+
azimuth,
|
82 |
+
camera_distance,
|
83 |
+
num_inference_steps,
|
84 |
+
],
|
85 |
+
outputs=[output],
|
86 |
+
cache_examples=True,
|
87 |
+
)
|
88 |
+
|
89 |
+
|
90 |
+
gradio_app = gr.Blocks()
|
91 |
+
with gradio_app:
|
92 |
+
gr.HTML(
|
93 |
+
"""
|
94 |
+
<h1 style='text-align: center'>
|
95 |
+
Demo of new view generation with [Stable-Zero123] (https://huggingface.co/stabilityai/stable-zero123) implemented in [stable-zero123-diffusers](https://huggingface.co/ashawkey/stable-zero123-diffusers)
|
96 |
+
</h1>
|
97 |
+
""")
|
98 |
+
with gr.Row():
|
99 |
+
with gr.Column():
|
100 |
+
app()
|
101 |
+
|
102 |
+
gradio_app.launch(debug=True)
|