ShoeGenv2 / app.py
MaxMilan1
changs
a2559bc
raw
history blame
3.2 kB
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()