forked from sail-sg/EditAnything
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsam2edit.py
28 lines (22 loc) · 1.09 KB
/
sam2edit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Edit Anything trained with Stable Diffusion + ControlNet + SAM + BLIP2
import os
import gradio as gr
from diffusers.utils import load_image
from sam2edit_lora import EditAnythingLoraModel, config_dict
from sam2edit_demo import create_demo_template
from huggingface_hub import hf_hub_download, snapshot_download
def create_demo(process, process_image_click=None):
examples = None
INFO = f'''
## EditAnything https://github.com/sail-sg/EditAnything
'''
WARNING_INFO = None
demo = create_demo_template(process, process_image_click, examples=examples,
INFO=INFO, WARNING_INFO=WARNING_INFO, enable_auto_prompt_default=True)
return demo
if __name__ == '__main__':
model = EditAnythingLoraModel(base_model_path="stabilityai/stable-diffusion-2-inpainting",
controlmodel_name='LAION Pretrained(v0-4)-SD21', extra_inpaint=False,
lora_model_path=None, use_blip=True)
demo = create_demo(model.process, model.process_image_click)
demo.queue().launch(server_name='0.0.0.0')