Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def run(image):
|
4 |
+
image = np.array(image, dtype=np.float32) / 255.0
|
5 |
+
images = multi_view_diffusion_pipeline("", image, guidance_scale=5, num_inference_steps=30, elevation=0)
|
6 |
+
|
7 |
+
images = [Image.fromarray((img * 255).astype("uint8")) for img in images]
|
8 |
+
|
9 |
+
width, height = images[0].size
|
10 |
+
grid_img = Image.new("RGB", (2 * width, 2 * height))
|
11 |
+
|
12 |
+
grid_img.paste(images[0], (0, 0))
|
13 |
+
grid_img.paste(images[1], (width, 0))
|
14 |
+
grid_img.paste(images[2], (0, height))
|
15 |
+
grid_img.paste(images[3], (width, height))
|
16 |
+
|
17 |
+
return grid_img
|
18 |
+
|
19 |
+
demo = gr.Interface(fn=run, inputs="image", outputs="image")
|
20 |
+
demo.launch()
|