Commit 2ea17309 authored by chenpangpang's avatar chenpangpang
Browse files

feat: 更新gradio页面,显示中文

parent eed80691
...@@ -36,7 +36,7 @@ MAX_SEED = np.iinfo(np.int32).max ...@@ -36,7 +36,7 @@ MAX_SEED = np.iinfo(np.int32).max
device = get_torch_device() device = get_torch_device()
dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32 dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32
STYLE_NAMES = list(styles.keys()) STYLE_NAMES = list(styles.keys())
DEFAULT_STYLE_NAME = "Watercolor" DEFAULT_STYLE_NAME = "(No style)"
# Load face encoder # Load face encoder
app = FaceAnalysis(name='antelopev2', root='./', providers=['CUDAExecutionProvider', 'CPUExecutionProvider']) app = FaceAnalysis(name='antelopev2', root='./', providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
...@@ -305,16 +305,15 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F ...@@ -305,16 +305,15 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F
1. 上传人物图片。 对于多人图像,我们只会检测最大的脸部。 确保脸部不要太小,并且没有明显遮挡或模糊。 1. 上传人物图片。 对于多人图像,我们只会检测最大的脸部。 确保脸部不要太小,并且没有明显遮挡或模糊。
2. (可选)上传另一个人的图像作为参考姿势。 如果没有上传,我们将使用第一张图像来提取姿势。 如果您在步骤1中使用了裁剪后的脸部,建议上传它以提取新的姿势。 2. (可选)上传另一个人的图像作为参考姿势。 如果没有上传,我们将使用第一张图像来提取姿势。 如果您在步骤1中使用了裁剪后的脸部,建议上传它以提取新的姿势。
3. (可选)输入文本prompt提示词,就像所有文生图应用中所做的那样. 3. (可选)输入文本prompt提示词,就像所有文生图应用中所做的那样.
4. 点击 <b>Submit</b> 按钮开始定制. 4. 点击 <b>提交</b> 按钮开始定制.
5. 分享美图给你的好友吧, enjoy😊! 5. 分享美图给你的好友吧, enjoy😊!
""" """
tips = r""" tips = r"""
### Usage tips of InstantID ### 使用技巧
1. If you're not satisfied with the similarity, try increasing the weight of "IdentityNet Strength" and "Adapter Strength." 1. 如果你对相似度不满意, 尝试增加"IdentityNet Strength"和"Adapter Strength"
2. If you feel that the saturation is too high, first decrease the Adapter strength. If it remains too high, then decrease the IdentityNet strength. 2. 如果你觉得饱和度太高, 首先尝试降低"Adapter strength"。如果仍然太高, 降低"“"IdentityNet strength"
3. If you find that text control is not as expected, decrease Adapter strength. 3. 如果你觉得文本控制不符合预期, 降低"Adapter strength"
4. If you find that realistic style is not good enough, go for our Github repo and use a more realistic base model.
""" """
css = ''' css = '''
...@@ -329,24 +328,24 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F ...@@ -329,24 +328,24 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F
with gr.Row(): with gr.Row():
with gr.Column(): with gr.Column():
# upload face image # upload face image
face_file = gr.Image(label="Upload a photo of your face", type="filepath") face_file = gr.Image(label="上传人物图片", type="filepath")
# optional: upload a reference pose image # optional: upload a reference pose image
pose_file = gr.Image(label="Upload a reference pose image (optional)", type="filepath") pose_file = gr.Image(label="上传参考pose图片(可选)", type="filepath")
# prompt # prompt
prompt = gr.Textbox(label="Prompt", prompt = gr.Textbox(label="Prompt",
info="Give simple prompt is enough to achieve good face fidelity", info="给出简单的提示就足以实现良好的面部保真度",
placeholder="A photo of a person", placeholder="A photo of a person",
value="") value="")
submit = gr.Button("Submit", variant="primary") submit = gr.Button("Submit", variant="primary")
enable_LCM = gr.Checkbox( enable_LCM = gr.Checkbox(
label="Enable Fast Inference with LCM", value=enable_lcm_arg, label="使用LCM加快推理速度", value=enable_lcm_arg,
info="LCM speeds up the inference step, the trade-off is the quality of the generated image. It performs better with portrait face images rather than distant faces", info="LCM可加快推理速度,但是生成图像的质量会变差",
) )
style = gr.Dropdown(label="Style template", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME) style = gr.Dropdown(label="风格模版", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
# strength # strength
identitynet_strength_ratio = gr.Slider( identitynet_strength_ratio = gr.Slider(
...@@ -364,7 +363,7 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F ...@@ -364,7 +363,7 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F
value=0.80, value=0.80,
) )
with gr.Accordion(open=False, label="Advanced Options"): with gr.Accordion(open=False, label="高级选项"):
negative_prompt = gr.Textbox( negative_prompt = gr.Textbox(
label="Negative Prompt", label="Negative Prompt",
placeholder="low quality", placeholder="low quality",
...@@ -395,8 +394,8 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F ...@@ -395,8 +394,8 @@ def main(pretrained_model_name_or_path="wangqixun/YamerMIX_v8", enable_lcm_arg=F
enhance_face_region = gr.Checkbox(label="Enhance non-face region", value=True) enhance_face_region = gr.Checkbox(label="Enhance non-face region", value=True)
with gr.Column(): with gr.Column():
gallery = gr.Image(label="Generated Images") gallery = gr.Image(label="生成图像")
usage_tips = gr.Markdown(label="Usage tips of InstantID", value=tips, visible=False) usage_tips = gr.Markdown(label="使用技巧", value=tips, visible=False)
submit.click( submit.click(
fn=remove_tips, fn=remove_tips,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment