import os import gradio as gr import numpy as np import torch from diffusers import DDIMScheduler from pytorch_lightning import seed_everything from masactrl.diffuser_utils import MasaCtrlPipeline from masactrl.masactrl_utils import (AttentionBase, regiter_attention_editor_diffusers) torch.set_grad_enabled(False) from gradio_app.image_synthesis_app import create_demo_synthesis from gradio_app.real_image_editing_app import create_demo_editing from gradio_app.app_utils import global_context SPACE_ID = os.getenv('SPACE_ID') TITLE = '# [MasaCtrl](https://ljzycmd.github.io/projects/MasaCtrl/)' DESCRIPTION = '
Gradio demo for MasaCtrl: [Github], [Paper]. If MasaCtrl is helpful, please help to ⭐ the Github Repo 😊
' DESCRIPTION += f'For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings.
' DESCRIPTION += '