Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
36 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
37 |
dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32
|
38 |
STYLE_NAMES = list(styles.keys())
|
39 |
-
DEFAULT_STYLE_NAME = "
|
40 |
enable_lcm_arg = False
|
41 |
|
42 |
# download checkpoints
|
@@ -137,7 +137,7 @@ controlnet_map_fn = {
|
|
137 |
"depth": get_depth_map,
|
138 |
}
|
139 |
|
140 |
-
pretrained_model_name_or_path = "
|
141 |
|
142 |
pipe = StableDiffusionXLInstantIDPipeline.from_pretrained(
|
143 |
pretrained_model_name_or_path,
|
@@ -430,17 +430,6 @@ title = r"""
|
|
430 |
<h1 align="center">InstantID: Zero-shot Identity-Preserving Generation in Seconds</h1>
|
431 |
"""
|
432 |
|
433 |
-
description = r"""
|
434 |
-
<b>Official 🤗 Gradio demo</b> for <a href='https://github.com/InstantID/InstantID' target='_blank'><b>InstantID: Zero-shot Identity-Preserving Generation in Seconds</b></a>.<br>
|
435 |
-
We are organizing a Spring Festival event with HuggingFace from 2.7 to 2.25, and you can now generate pictures of Spring Festival costumes. Happy Dragon Year 🐲 ! Share the joy with your family.<br>
|
436 |
-
How to use:<br>
|
437 |
-
1. Upload an image with a face. For images with multiple faces, we will only detect the largest face. Ensure the face is not too small and is clearly visible without significant obstructions or blurring.
|
438 |
-
2. (Optional) You can upload another image as a reference for the face pose. If you don't, we will use the first detected face image to extract facial landmarks. If you use a cropped face at step 1, it is recommended to upload it to define a new face pose.
|
439 |
-
3. (Optional) You can select multiple ControlNet models to control the generation process. The default is to use the IdentityNet only. The ControlNet models include pose skeleton, canny, and depth. You can adjust the strength of each ControlNet model to control the generation process.
|
440 |
-
4. Enter a text prompt, as done in normal text-to-image models.
|
441 |
-
5. Click the <b>Submit</b> button to begin customization.
|
442 |
-
6. Share your customized photo with your friends and enjoy! 😊"""
|
443 |
-
|
444 |
article = r"""
|
445 |
---
|
446 |
📝 **Citation**
|
@@ -524,7 +513,7 @@ with gr.Blocks(css=css) as demo:
|
|
524 |
)
|
525 |
with gr.Accordion("Controlnet"):
|
526 |
controlnet_selection = gr.CheckboxGroup(
|
527 |
-
["canny", "depth"], label="Controlnet", value=[
|
528 |
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"
|
529 |
)
|
530 |
# pose_strength = gr.Slider(
|
@@ -539,14 +528,14 @@ with gr.Blocks(css=css) as demo:
|
|
539 |
minimum=0,
|
540 |
maximum=1.5,
|
541 |
step=0.05,
|
542 |
-
value=0
|
543 |
)
|
544 |
depth_strength = gr.Slider(
|
545 |
label="Depth strength",
|
546 |
minimum=0,
|
547 |
maximum=1.5,
|
548 |
step=0.05,
|
549 |
-
value=0
|
550 |
)
|
551 |
with gr.Accordion(open=False, label="Advanced Options"):
|
552 |
negative_prompt = gr.Textbox(
|
|
|
36 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
37 |
dtype = torch.float16 if str(device).__contains__("cuda") else torch.float32
|
38 |
STYLE_NAMES = list(styles.keys())
|
39 |
+
DEFAULT_STYLE_NAME = "(No style)"
|
40 |
enable_lcm_arg = False
|
41 |
|
42 |
# download checkpoints
|
|
|
137 |
"depth": get_depth_map,
|
138 |
}
|
139 |
|
140 |
+
pretrained_model_name_or_path = "SG161222/RealVisXL_V5.0"
|
141 |
|
142 |
pipe = StableDiffusionXLInstantIDPipeline.from_pretrained(
|
143 |
pretrained_model_name_or_path,
|
|
|
430 |
<h1 align="center">InstantID: Zero-shot Identity-Preserving Generation in Seconds</h1>
|
431 |
"""
|
432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
article = r"""
|
434 |
---
|
435 |
📝 **Citation**
|
|
|
513 |
)
|
514 |
with gr.Accordion("Controlnet"):
|
515 |
controlnet_selection = gr.CheckboxGroup(
|
516 |
+
["canny", "depth"], label="Controlnet", value=[],
|
517 |
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"
|
518 |
)
|
519 |
# pose_strength = gr.Slider(
|
|
|
528 |
minimum=0,
|
529 |
maximum=1.5,
|
530 |
step=0.05,
|
531 |
+
value=0,
|
532 |
)
|
533 |
depth_strength = gr.Slider(
|
534 |
label="Depth strength",
|
535 |
minimum=0,
|
536 |
maximum=1.5,
|
537 |
step=0.05,
|
538 |
+
value=0,
|
539 |
)
|
540 |
with gr.Accordion(open=False, label="Advanced Options"):
|
541 |
negative_prompt = gr.Textbox(
|