Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,175 Bytes
a3a3ae4 f8bdccb a3a3ae4 e5cd8c6 a3a3ae4 e5cd8c6 a3a3ae4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import gradio as gr
import spaces
from PIL import Image
from typing import List
from pipeline import prepare_white_image, MultiViewGenerator
from util import download_file, unzip_file
download_file("https://huggingface.co/aki-0421/character-360/resolve/main/v2.ckpt", "v2.ckpt")
download_file("https://huggingface.co/hbyang/Hi3D/resolve/main/ckpts.zip", "ckpts.zip")
unzip_file("ckpts.zip", ".")
multi_view_generator = MultiViewGenerator(checkpoint_path="v2.ckpt")
@spaces.GPU(duration=120)
def generate_images(input_image: Image.Image) -> List[Image.Image]:
white_image = prepare_white_image(input_image=input_image)
return multi_view_generator.infer(white_image=white_image)
with gr.Blocks() as demo:
gr.Markdown("# Character-360")
gr.Markdown("Do you want to check out your character in 360°?")
with gr.Row():
input_image = gr.Image(label="Input Image", type="pil")
output_gallery = gr.Gallery(
label="Generated images", show_label=False, elem_id="gallery"
, columns=[3], object_fit="contain", height="auto")
btn = gr.Button("Generate")
btn.click(generate_images, input_image, output_gallery)
demo.launch() |