File size: 3,200 Bytes
2cf6be0 a2559bc 09339b5 2cf6be0 fa0ee64 a2559bc ad9ba71 a2559bc 2cf6be0 63f29cf 09339b5 63f29cf fa0ee64 |
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
import gradio as gr
# from util.text_img import generate_image
from util.v3d import generate_v3d, prep
# Prepare the V3D model
model, clip_model, ae_model, device, num_frames, num_steps, rembg_session, output_folder = prep()
_TITLE = "Shoe Generator"
with gr.Blocks(_TITLE) as ShoeGen:
# with gr.Tab("Text to Image Generator"):
# with gr.Row():
# with gr.Column():
# prompt = gr.Textbox(label="Enter a discription of a shoe")
# # neg_prompt = gr.Textbox(label="Enter a negative prompt", value="low quality, watermark, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, body out of frame, blurry, bad anatomy, blurred, watermark, grainy, signature, cut off, draft, closed eyes, text, logo")
# button_gen = gr.Button("Generate Image")
# with gr.Column():
# with gr.Tab("With Background"):
# image = gr.Image(label="Generated Image", show_download_button=True, show_label=False)
# with gr.Tab("Without Background"):
# image_nobg = gr.Image(label="Generated Image", show_download_button=True, show_label=False)
# button_gen.click(generate_image, inputs=[prompt], outputs=[image, image_nobg])
with gr.Tab("Image to Video Generator (V3D)"):
with gr.Row(equal_height=True):
with gr.Column():
input_image = gr.Image(value=None, label="Input Image")
border_ratio_slider = gr.Slider(
value=0.3,
label="Border Ratio",
minimum=0.05,
maximum=0.5,
step=0.05,
)
decoding_t_slider = gr.Slider(
value=1,
label="Number of Decoding frames",
minimum=1,
maximum=num_frames,
step=1,
)
min_guidance_slider = gr.Slider(
value=3.5,
label="Min CFG Value",
minimum=0.05,
maximum=0.5,
step=0.05,
)
max_guidance_slider = gr.Slider(
value=3.5,
label="Max CFG Value",
minimum=0.05,
maximum=0.5,
step=0.05,
)
run_button = gr.Button(value="Run V3D")
with gr.Column():
output_video = gr.Video(value=None, label="Output Orbit Video")
run_button.click(generate_v3d,
inputs=[
input_image,
model,
clip_model,
ae_model,
num_frames,
num_steps,
int(decoding_t_slider),
border_ratio_slider,
False,
rembg_session,
output_folder,
min_guidance_slider,
max_guidance_slider,
device,
],
outputs=[output_video],
)
ShoeGen.launch()
|