Spaces:
Runtime error
Runtime error
Update app.py
Browse files16 unmodified lines1718192021222313 unmodified lines3738394041424361 unmodified lines1051061071081091101112 unmodified lines11411511611711811912029 unmodified lines15015115215315415515615715815916016116216316416516616720 unmodified lines18818919019119219316 unmodified linesseed = random.randint(0, MAX_SEED)return seeddef get_instantID(portrait_in, condition_pose, prompt, style):negative_prompt = "(lowres, low quality, worst quality:1.2), (text:1.2), watermark, (frame:1.2), deformed, ugly, deformed eyes, blur, out of focus, blurry, deformed cat, deformed, photo, anthropomorphic cat, monochrome, pet collar, gun, weapon, blue, 3d, drones, drone, buildings in background, green"13 unmodified lines0.4, # float (numeric value between 0 and 1.5) in 'Pose strength' Slider component0.4, # float (numeric value between 0 and 1.5) in 'Canny strength' Slider component0.4, # float (numeric value between 0 and 1.5) in 'Depth strength' Slider component["pose"], # List[Literal['pose', 'canny', 'depth']] in 'Controlnet' Checkboxgroup component1.5, # float (numeric value between 0.1 and 20.0) in 'Guidance scale' Slider componentseed, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component"EulerDiscreteScheduler", # Literal['DEISMultistepScheduler', 'HeunDiscreteScheduler', 'EulerDiscreteScheduler', 'DPMSolverMultistepScheduler', 'DPMSolverMultistepScheduler-Karras', 'DPMSolverMultistepScheduler-Karras-SDE'] in 'Schedulers' Dropdown component61 unmodified linesprint(result)return resultdef infer(image_in, camera_shot, conditional_pose, prompt, style, chosen_model):if camera_shot == "custom":if conditional_pose != None:2 unmodified linesraise gr.Error("No custom conditional shot found !")iid_img = get_instantID(image_in, conditional_pose, prompt, style)#short_cap = get_short_caption(iid_img)29 unmodified lineswith gr.Column():face_in = gr.Image(type="filepath", label="Face to copy", value="monalisa.png")with gr.Column():with gr.Row():camera_shot = gr.Dropdown(label = "Camera Shot",info = "Use standard camera shots vocabulary, or drop your custom shot as conditional pose (1280*720 ratio is recommended)",choices = ["custom", "close-up", "medium close-up", "medium shot", "cowboy shot", "medium full shot", "full shot"],value = "custom")style = gr.Dropdown(label="Style template", info="InstantID legacy templates", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)condition_shot = gr.Image(type="filepath", label="Custom conditional shot (Important) [1280*720 recommended]")prompt = gr.Textbox(label="Short Prompt (keeping it short is better)")chosen_model = gr.Radio(label="Choose a model", choices=["i2vgen-xl", "stable-video"], value="i2vgen-xl", interactive=False, visible=False)20 unmodified linesface_in,camera_shot,condition_shot,prompt,style,chosen_model16 unmodified lines1718192021222313 unmodified lines3738394041424361 unmodified lines1051061071081091101112 unmodified lines11411511611711811912029 unmodified lines15015115215315415515615715815916016116216316416516616716816917017117220 unmodified lines19319419519619719819916 unmodified linesseed = random.randint(0, MAX_SEED)return seeddef get_instantID(portrait_in, condition_pose, controlnet, prompt, style):negative_prompt = "(lowres, low quality, worst quality:1.2), (text:1.2), watermark, (frame:1.2), deformed, ugly, deformed eyes, blur, out of focus, blurry, deformed cat, deformed, photo, anthropomorphic cat, monochrome, pet collar, gun, weapon, blue, 3d, drones, drone, buildings in background, green"13 unmodified lines0.4, # float (numeric value between 0 and 1.5) in 'Pose strength' Slider component0.4, # float (numeric value between 0 and 1.5) in 'Canny strength' Slider component0.4, # float (numeric value between 0 and 1.5) in 'Depth strength' Slider componentcontrolnet, # List[Literal['pose', 'canny', 'depth']] in 'Controlnet' Checkboxgroup component1.5, # float (numeric value between 0.1 and 20.0) in 'Guidance scale' Slider componentseed, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component"EulerDiscreteScheduler", # Literal['DEISMultistepScheduler', 'HeunDiscreteScheduler', 'EulerDiscreteScheduler', 'DPMSolverMultistepScheduler', 'DPMSolverMultistepScheduler-Karras', 'DPMSolverMultistepScheduler-Karras-SDE'] in 'Schedulers' Dropdown component61 unmodified linesprint(result)return resultdef infer(image_in, camera_shot, conditional_pose, controlnet_selection, prompt, style, chosen_model):if camera_shot == "custom":if conditional_pose != None:2 unmodified linesraise gr.Error("No custom conditional shot found !")iid_img = get_instantID(image_in, conditional_pose, controlnet_selection, prompt, style)#short_cap = get_short_caption(iid_img)29 unmodified lineswith gr.Column():face_in = gr.Image(type="filepath", label="Face to copy", value="monalisa.png")with gr.Column():with gr.Group():with gr.Row():camera_shot = gr.Dropdown(label = "Camera Shot",info = "Use standard camera shots vocabulary, or drop your custom shot as conditional pose (1280*720 ratio is recommended)",choices = ["custom", "close-up", "medium close-up", "medium shot", "cowboy shot", "medium full shot", "full shot"],value = "custom")style = gr.Dropdown(label="Style template", info="InstantID legacy templates", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)condition_shot = gr.Image(type="filepath", label="Custom conditional shot (Important) [1280*720 recommended]")controlnet_selection = gr.CheckboxGroup(["pose", "canny", "depth"], label="Controlnet", value=["pose"],info="Use pose for skeleton inference, canny for edge detection, and depth for depth map estimation. You can try all three to control the generation process")prompt = gr.Textbox(label="Short Prompt (keeping it short is better)")chosen_model = gr.Radio(label="Choose a model", choices=["i2vgen-xl", "stable-video"], value="i2vgen-xl", interactive=False, visible=False)20 unmodified linesface_in,camera_shot,condition_shot,controlnet_selection,prompt,style,chosen_model
app.py+21-15