doc: update

This commit is contained in:
guojianzhu 2024-08-06 22:40:44 +08:00
parent d74730ee6d
commit 3802be488b
6 changed files with 37 additions and 14 deletions

36
app.py
View File

@ -65,6 +65,10 @@ def gpu_wrapped_execute_image_retargeting(*args, **kwargs):
def gpu_wrapped_execute_video_retargeting(*args, **kwargs): def gpu_wrapped_execute_video_retargeting(*args, **kwargs):
return gradio_pipeline.execute_video_retargeting(*args, **kwargs) return gradio_pipeline.execute_video_retargeting(*args, **kwargs)
def reset_sliders(*args, **kwargs):
return 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.5, True, True
# assets # assets
title_md = "assets/gradio/gradio_title.md" title_md = "assets/gradio/gradio_title.md"
example_portrait_dir = "assets/examples/source" example_portrait_dir = "assets/examples/source"
@ -101,14 +105,14 @@ mov_x = gr.Slider(minimum=-0.19, maximum=0.19, value=0.0, step=0.01, label="x-ax
mov_y = gr.Slider(minimum=-0.19, maximum=0.19, value=0.0, step=0.01, label="y-axis movement") mov_y = gr.Slider(minimum=-0.19, maximum=0.19, value=0.0, step=0.01, label="y-axis movement")
mov_z = gr.Slider(minimum=0.9, maximum=1.2, value=1.0, step=0.01, label="z-axis movement") mov_z = gr.Slider(minimum=0.9, maximum=1.2, value=1.0, step=0.01, label="z-axis movement")
lip_variation_zero = gr.Slider(minimum=-0.09, maximum=0.09, value=0, step=0.01, label="pouting") lip_variation_zero = gr.Slider(minimum=-0.09, maximum=0.09, value=0, step=0.01, label="pouting")
lip_variation_one = gr.Slider(minimum=-20.0, maximum=15.0, value=0, step=0.01, label="lip compressed<->pursing") lip_variation_one = gr.Slider(minimum=-20.0, maximum=15.0, value=0, step=0.01, label="pursing 😐")
lip_variation_two = gr.Slider(minimum=0.0, maximum=15.0, value=0, step=0.01, label="grin") lip_variation_two = gr.Slider(minimum=0.0, maximum=15.0, value=0, step=0.01, label="grin 😁")
lip_variation_three = gr.Slider(minimum=-90.0, maximum=120.0, value=0, step=1.0, label="lip close <-> lip open") lip_variation_three = gr.Slider(minimum=-90.0, maximum=120.0, value=0, step=1.0, label="lip close <-> open")
smile = gr.Slider(minimum=-0.3, maximum=1.3, value=0, step=0.01, label="smile") smile = gr.Slider(minimum=-0.3, maximum=1.3, value=0, step=0.01, label="smile 😄")
wink = gr.Slider(minimum=0, maximum=39, value=0, step=0.01, label="wink") wink = gr.Slider(minimum=0, maximum=39, value=0, step=0.01, label="wink 😉")
eyebrow = gr.Slider(minimum=-30, maximum=30, value=0, step=0.01, label="eyebrow") eyebrow = gr.Slider(minimum=-30, maximum=30, value=0, step=0.01, label="eyebrow 🤨")
eyeball_direction_x = gr.Slider(minimum=-30.0, maximum=30.0, value=0, step=0.01, label="eye gaze (horizontal)") eyeball_direction_x = gr.Slider(minimum=-30.0, maximum=30.0, value=0, step=0.01, label="eye gaze (horizontal) 👀")
eyeball_direction_y = gr.Slider(minimum=-63.0, maximum=63.0, value=0, step=0.01, label="eye gaze (vertical)") eyeball_direction_y = gr.Slider(minimum=-63.0, maximum=63.0, value=0, step=0.01, label="eye gaze (vertical) 🙄")
retargeting_input_image = gr.Image(type="filepath") retargeting_input_image = gr.Image(type="filepath")
retargeting_input_video = gr.Video() retargeting_input_video = gr.Video()
output_image = gr.Image(type="numpy") output_image = gr.Image(type="numpy")
@ -293,6 +297,17 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Plus Jakarta San
eyebrow.render() eyebrow.render()
eyeball_direction_x.render() eyeball_direction_x.render()
eyeball_direction_y.render() eyeball_direction_y.render()
with gr.Row(visible=True):
reset_button = gr.Button("🔄 Reset")
reset_button.click(
fn=reset_sliders,
inputs=None,
outputs=[
head_pitch_slider, head_yaw_slider, head_roll_slider, mov_x, mov_y, mov_z,
lip_variation_zero, lip_variation_one, lip_variation_two, lip_variation_three, smile, wink, eyebrow, eyeball_direction_x, eyeball_direction_y,
retargeting_source_scale, flag_stitching_retargeting_input, flag_do_crop_input_retargeting_image
]
)
with gr.Row(visible=True): with gr.Row(visible=True):
with gr.Column(): with gr.Column():
with gr.Accordion(open=True, label="Retargeting Image Input"): with gr.Accordion(open=True, label="Retargeting Image Input"):
@ -306,7 +321,8 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Plus Jakarta San
[osp.join(example_portrait_dir, "s7.jpg")], [osp.join(example_portrait_dir, "s7.jpg")],
[osp.join(example_portrait_dir, "s12.jpg")], [osp.join(example_portrait_dir, "s12.jpg")],
[osp.join(example_portrait_dir, "s22.jpg")], [osp.join(example_portrait_dir, "s22.jpg")],
[osp.join(example_portrait_dir, "s23.jpg")], # [osp.join(example_portrait_dir, "s23.jpg")],
[osp.join(example_portrait_dir, "s42.jpg")],
], ],
inputs=[retargeting_input_image], inputs=[retargeting_input_image],
cache_examples=False, cache_examples=False,
@ -322,7 +338,7 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Plus Jakarta San
[ [
retargeting_input_image, retargeting_input_image,
retargeting_output_image, retargeting_output_image,
retargeting_output_image_paste_back retargeting_output_image_paste_back,
], ],
value="🧹 Clear" value="🧹 Clear"
) )

View File

@ -0,0 +1,7 @@
## Portrait Editing
<p align="center">
<img src="../editing-portrait-2024-08-06.jpg" alt="LivePortrait" width="960px">
<br>
Portrait Editing in the Gradio Interface
</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -6,9 +6,8 @@
<div style="display: flex; justify-content: center; align-items: center; text-align: center; font-size: 1.2em;"> <div style="display: flex; justify-content: center; align-items: center; text-align: center; font-size: 1.2em;">
<div> <div>
<h2>Retargeting Image</h2> <h2>Retargeting and Editing Portraits</h2>
<p>Upload a Source Portrait as Retargeting Input, wait for the <code>target eyes-open ratio</code> and <code>target lip-open ratio</code> to be calculated, and then drag the sliders. You can try running it multiple times. <p>Upload a source portrait, and the <code>eyes-open ratio</code> and <code>lip-open ratio</code> will be auto-calculated. Adjust the sliders to see instant edits. Feel free to experiment! 🎨</p>
<br>
<strong>😊 Set both target eyes-open and lip-open ratios to 0.8 to see what's going on!</strong></p> <strong>😊 Set both target eyes-open and lip-open ratios to 0.8 to see what's going on!</strong></p>
</div> </div>
</div> </div>

View File

@ -38,7 +38,8 @@
## 🔥 Updates ## 🔥 Updates
- **`2024/08/05`**: 📦 Windows users download the [one-click installer](https://huggingface.co/cleardusk/LivePortrait-Windows/blob/main/LivePortrait-Windows-v20240805.zip) for Humans mode and **Animals mode** now! For details, see [**here**](./assets/docs/changelog/2024-08-05.md). - **`2024/08/06`**: 🎨 We support precise static portrait editing in the Gradio interface, insipred by [ComfyUI-AdvancedLivePortrait](https://github.com/PowerHouseMan/ComfyUI-AdvancedLivePortrait). See [here](./assets/docs/changelog/2024-08-06.md).
- **`2024/08/05`**: 📦 Windows users can now download the [one-click installer](https://huggingface.co/cleardusk/LivePortrait-Windows/blob/main/LivePortrait-Windows-v20240805.zip) for Humans mode and **Animals mode** now! For details, see [**here**](./assets/docs/changelog/2024-08-05.md).
- **`2024/08/02`**: 😸 We released a version of the **Animals model**, along with several other updates and improvements. Check out the details [**here**](./assets/docs/changelog/2024-08-02.md)! - **`2024/08/02`**: 😸 We released a version of the **Animals model**, along with several other updates and improvements. Check out the details [**here**](./assets/docs/changelog/2024-08-02.md)!
- **`2024/07/25`**: 📦 Windows users can now download the package from [HuggingFace](https://huggingface.co/cleardusk/LivePortrait-Windows/tree/main) or [BaiduYun](https://pan.baidu.com/s/1FWsWqKe0eNfXrwjEhhCqlw?pwd=86q2). Simply unzip and double-click `run_windows.bat` to enjoy! - **`2024/07/25`**: 📦 Windows users can now download the package from [HuggingFace](https://huggingface.co/cleardusk/LivePortrait-Windows/tree/main) or [BaiduYun](https://pan.baidu.com/s/1FWsWqKe0eNfXrwjEhhCqlw?pwd=86q2). Simply unzip and double-click `run_windows.bat` to enjoy!
- **`2024/07/24`**: 🎨 We support pose editing for source portraits in the Gradio interface. Weve also lowered the default detection threshold to increase recall. [Have fun](assets/docs/changelog/2024-07-24.md)! - **`2024/07/24`**: 🎨 We support pose editing for source portraits in the Gradio interface. Weve also lowered the default detection threshold to increase recall. [Have fun](assets/docs/changelog/2024-07-24.md)!