Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	update
Browse files- .gitignore +2 -1
 - app.py +4 -4
 - app_000.py +0 -7
 - app_001.py +0 -199
 - inference.py +1 -1
 
    	
        .gitignore
    CHANGED
    
    | 
         @@ -1 +1,2 @@ 
     | 
|
| 1 | 
         
            -
            experiments/*
         
     | 
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            experiments/*
         
     | 
| 2 | 
         
            +
            trash/*
         
     | 
    	
        app.py
    CHANGED
    
    | 
         @@ -81,7 +81,7 @@ def reload_custom_diffusion_weight_list() -> dict: 
     | 
|
| 81 | 
         
             
                return gr.update(choices=find_weight_files())
         
     | 
| 82 | 
         | 
| 83 | 
         | 
| 84 | 
         
            -
            def create_inference_demo( 
     | 
| 85 | 
         
             
                with gr.Blocks() as demo:
         
     | 
| 86 | 
         
             
                    with gr.Row():
         
     | 
| 87 | 
         
             
                        with gr.Column():
         
     | 
| 
         @@ -125,7 +125,7 @@ def create_inference_demo(pipe: InferencePipeline) -> gr.Blocks: 
     | 
|
| 125 | 
         
             
                    reload_button.click(fn=reload_custom_diffusion_weight_list,
         
     | 
| 126 | 
         
             
                                        inputs=None,
         
     | 
| 127 | 
         
             
                                        outputs=weight_name)
         
     | 
| 128 | 
         
            -
                    prompt.submit(fn= 
     | 
| 129 | 
         
             
                                  inputs=[
         
     | 
| 130 | 
         
             
                                      model_id,
         
     | 
| 131 | 
         
             
                                      prompt,
         
     | 
| 
         @@ -134,7 +134,7 @@ def create_inference_demo(pipe: InferencePipeline) -> gr.Blocks: 
     | 
|
| 134 | 
         
             
                                  ],
         
     | 
| 135 | 
         
             
                                  outputs=result,
         
     | 
| 136 | 
         
             
                                  queue=False)
         
     | 
| 137 | 
         
            -
                    run_button.click(fn= 
     | 
| 138 | 
         
             
                                    inputs=[
         
     | 
| 139 | 
         
             
                                        model_id,
         
     | 
| 140 | 
         
             
                                        prompt,
         
     | 
| 
         @@ -159,7 +159,7 @@ with gr.Blocks(css='style.css') as demo: 
     | 
|
| 159 | 
         
             
                with gr.Tabs():
         
     | 
| 160 | 
         | 
| 161 | 
         
             
                    with gr.TabItem('Test'):
         
     | 
| 162 | 
         
            -
                        create_inference_demo( 
     | 
| 163 | 
         | 
| 164 | 
         | 
| 165 | 
         
             
            demo.queue(default_enabled=False).launch(share=False)
         
     | 
| 
         | 
|
| 81 | 
         
             
                return gr.update(choices=find_weight_files())
         
     | 
| 82 | 
         | 
| 83 | 
         | 
| 84 | 
         
            +
            def create_inference_demo(func: inference_fn) -> gr.Blocks:
         
     | 
| 85 | 
         
             
                with gr.Blocks() as demo:
         
     | 
| 86 | 
         
             
                    with gr.Row():
         
     | 
| 87 | 
         
             
                        with gr.Column():
         
     | 
| 
         | 
|
| 125 | 
         
             
                    reload_button.click(fn=reload_custom_diffusion_weight_list,
         
     | 
| 126 | 
         
             
                                        inputs=None,
         
     | 
| 127 | 
         
             
                                        outputs=weight_name)
         
     | 
| 128 | 
         
            +
                    prompt.submit(fn=func,
         
     | 
| 129 | 
         
             
                                  inputs=[
         
     | 
| 130 | 
         
             
                                      model_id,
         
     | 
| 131 | 
         
             
                                      prompt,
         
     | 
| 
         | 
|
| 134 | 
         
             
                                  ],
         
     | 
| 135 | 
         
             
                                  outputs=result,
         
     | 
| 136 | 
         
             
                                  queue=False)
         
     | 
| 137 | 
         
            +
                    run_button.click(fn=func,
         
     | 
| 138 | 
         
             
                                    inputs=[
         
     | 
| 139 | 
         
             
                                        model_id,
         
     | 
| 140 | 
         
             
                                        prompt,
         
     | 
| 
         | 
|
| 159 | 
         
             
                with gr.Tabs():
         
     | 
| 160 | 
         | 
| 161 | 
         
             
                    with gr.TabItem('Test'):
         
     | 
| 162 | 
         
            +
                        create_inference_demo(inference_fn)
         
     | 
| 163 | 
         | 
| 164 | 
         | 
| 165 | 
         
             
            demo.queue(default_enabled=False).launch(share=False)
         
     | 
    	
        app_000.py
    DELETED
    
    | 
         @@ -1,7 +0,0 @@ 
     | 
|
| 1 | 
         
            -
            import gradio as gr
         
     | 
| 2 | 
         
            -
             
     | 
| 3 | 
         
            -
            def greet(name):
         
     | 
| 4 | 
         
            -
                return "Hello " + name + "!!"
         
     | 
| 5 | 
         
            -
             
     | 
| 6 | 
         
            -
            iface = gr.Interface(fn=greet, inputs="text", outputs="text")
         
     | 
| 7 | 
         
            -
            iface.launch()
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
    	
        app_001.py
    DELETED
    
    | 
         @@ -1,199 +0,0 @@ 
     | 
|
| 1 | 
         
            -
            #!/usr/bin/env python
         
     | 
| 2 | 
         
            -
            """Demo app for https://github.com/adobe-research/custom-diffusion.
         
     | 
| 3 | 
         
            -
            The code in this repo is partly adapted from the following repository:
         
     | 
| 4 | 
         
            -
            https://huggingface.co/spaces/hysts/LoRA-SD-training
         
     | 
| 5 | 
         
            -
            MIT License
         
     | 
| 6 | 
         
            -
            Copyright (c) 2022 hysts
         
     | 
| 7 | 
         
            -
            ==========================================================================================
         
     | 
| 8 | 
         
            -
            Adobe’s modifications are Copyright 2022 Adobe Research. All rights reserved.
         
     | 
| 9 | 
         
            -
            Adobe’s modifications are licensed under the Adobe Research License. To view a copy of the license, visit
         
     | 
| 10 | 
         
            -
            LICENSE.
         
     | 
| 11 | 
         
            -
            ==========================================================================================
         
     | 
| 12 | 
         
            -
            """
         
     | 
| 13 | 
         
            -
             
     | 
| 14 | 
         
            -
            from __future__ import annotations
         
     | 
| 15 | 
         
            -
            import sys
         
     | 
| 16 | 
         
            -
            import os
         
     | 
| 17 | 
         
            -
            import pathlib
         
     | 
| 18 | 
         
            -
             
     | 
| 19 | 
         
            -
            import gradio as gr
         
     | 
| 20 | 
         
            -
            import torch
         
     | 
| 21 | 
         
            -
             
     | 
| 22 | 
         
            -
            from inference import InferencePipeline
         
     | 
| 23 | 
         
            -
            from trainer import Trainer
         
     | 
| 24 | 
         
            -
            from uploader import upload
         
     | 
| 25 | 
         
            -
             
     | 
| 26 | 
         
            -
            TITLE = '# Custom Diffusion + StableDiffusion Training UI'
         
     | 
| 27 | 
         
            -
            DESCRIPTION = '''This is a demo for [https://github.com/adobe-research/custom-diffusion](https://github.com/adobe-research/custom-diffusion).
         
     | 
| 28 | 
         
            -
            It is recommended to upgrade to GPU in Settings after duplicating this space to use it.
         
     | 
| 29 | 
         
            -
            <a href="https://huggingface.co/spaces/nupurkmr9/custom-diffusion?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
         
     | 
| 30 | 
         
            -
            '''
         
     | 
| 31 | 
         
            -
            DETAILDESCRIPTION='''
         
     | 
| 32 | 
         
            -
            Custom Diffusion allows you to fine-tune text-to-image diffusion models, such as Stable Diffusion, given a few images of a new concept (~4-20).
         
     | 
| 33 | 
         
            -
            We fine-tune only a subset of model parameters, namely key and value projection matrices, in the cross-attention layers and the modifier token used to represent the object.
         
     | 
| 34 | 
         
            -
            This also reduces the extra storage for each additional concept to 75MB. Our method also allows you to use a combination of concepts. There's still limitations on which compositions work. For more analysis please refer to our [website](https://www.cs.cmu.edu/~custom-diffusion/).
         
     | 
| 35 | 
         
            -
            <center>
         
     | 
| 36 | 
         
            -
            <img src="https://huggingface.co/spaces/nupurkmr9/custom-diffusion/resolve/main/method.jpg" width="600" align="center" >
         
     | 
| 37 | 
         
            -
            </center>
         
     | 
| 38 | 
         
            -
            '''
         
     | 
| 39 | 
         
            -
             
     | 
| 40 | 
         
            -
            ORIGINAL_SPACE_ID = 'nupurkmr9/custom-diffusion'
         
     | 
| 41 | 
         
            -
            SPACE_ID = os.getenv('SPACE_ID', ORIGINAL_SPACE_ID)
         
     | 
| 42 | 
         
            -
            SHARED_UI_WARNING = f'''# Attention - This Space doesn't work in this shared UI. You can duplicate and use it with a paid private T4 GPU.
         
     | 
| 43 | 
         
            -
            <center><a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></center>
         
     | 
| 44 | 
         
            -
            '''
         
     | 
| 45 | 
         
            -
            if os.getenv('SYSTEM') == 'spaces' and SPACE_ID != ORIGINAL_SPACE_ID:
         
     | 
| 46 | 
         
            -
                SETTINGS = f'<a href="https://huggingface.co/spaces/{SPACE_ID}/settings">Settings</a>'
         
     | 
| 47 | 
         
            -
             
     | 
| 48 | 
         
            -
            else:
         
     | 
| 49 | 
         
            -
                SETTINGS = 'Settings'
         
     | 
| 50 | 
         
            -
            CUDA_NOT_AVAILABLE_WARNING = f'''# Attention - Running on CPU.
         
     | 
| 51 | 
         
            -
            <center>
         
     | 
| 52 | 
         
            -
            You can assign a GPU in the {SETTINGS} tab if you are running this on HF Spaces.
         
     | 
| 53 | 
         
            -
            "T4 small" is sufficient to run this demo.
         
     | 
| 54 | 
         
            -
            </center>
         
     | 
| 55 | 
         
            -
            '''
         
     | 
| 56 | 
         
            -
             
     | 
| 57 | 
         
            -
            os.system("git clone https://github.com/ziqihuangg/ReVersion")
         
     | 
| 58 | 
         
            -
            sys.path.append("ReVersion")
         
     | 
| 59 | 
         
            -
             
     | 
| 60 | 
         
            -
             
     | 
| 61 | 
         
            -
            def show_warning(warning_text: str) -> gr.Blocks:
         
     | 
| 62 | 
         
            -
                with gr.Blocks() as demo:
         
     | 
| 63 | 
         
            -
                    with gr.Box():
         
     | 
| 64 | 
         
            -
                        gr.Markdown(warning_text)
         
     | 
| 65 | 
         
            -
                return demo
         
     | 
| 66 | 
         
            -
             
     | 
| 67 | 
         
            -
             
     | 
| 68 | 
         
            -
            def update_output_files() -> dict:
         
     | 
| 69 | 
         
            -
                paths = sorted(pathlib.Path('results').glob('*.bin'))
         
     | 
| 70 | 
         
            -
                paths = [path.as_posix() for path in paths]  # type: ignore
         
     | 
| 71 | 
         
            -
                return gr.update(value=paths or None)
         
     | 
| 72 | 
         
            -
             
     | 
| 73 | 
         
            -
             
     | 
| 74 | 
         
            -
            def find_weight_files() -> list[str]:
         
     | 
| 75 | 
         
            -
                curr_dir = pathlib.Path(__file__).parent
         
     | 
| 76 | 
         
            -
                paths = sorted(curr_dir.rglob('*.bin'))
         
     | 
| 77 | 
         
            -
                paths = [path for path in paths if '.lfs' not in str(path)]
         
     | 
| 78 | 
         
            -
                return [path.relative_to(curr_dir).as_posix() for path in paths]
         
     | 
| 79 | 
         
            -
             
     | 
| 80 | 
         
            -
             
     | 
| 81 | 
         
            -
            def reload_custom_diffusion_weight_list() -> dict:
         
     | 
| 82 | 
         
            -
                return gr.update(choices=find_weight_files())
         
     | 
| 83 | 
         
            -
             
     | 
| 84 | 
         
            -
             
     | 
| 85 | 
         
            -
            def create_inference_demo(pipe: InferencePipeline) -> gr.Blocks:
         
     | 
| 86 | 
         
            -
                with gr.Blocks() as demo:
         
     | 
| 87 | 
         
            -
                    with gr.Row():
         
     | 
| 88 | 
         
            -
                        with gr.Column():
         
     | 
| 89 | 
         
            -
                            base_model = gr.Dropdown(
         
     | 
| 90 | 
         
            -
                                choices=['ReVersion/experiments/painted_on'],
         
     | 
| 91 | 
         
            -
                                value='ReVersion/experiments/painted_on',
         
     | 
| 92 | 
         
            -
                                label='Base Model',
         
     | 
| 93 | 
         
            -
                                visible=True)
         
     | 
| 94 | 
         
            -
                            resolution = gr.Dropdown(choices=[512, 768],
         
     | 
| 95 | 
         
            -
                                             value=512,
         
     | 
| 96 | 
         
            -
                                             label='Resolution',
         
     | 
| 97 | 
         
            -
                                             visible=True)
         
     | 
| 98 | 
         
            -
                            reload_button = gr.Button('Reload Weight List')
         
     | 
| 99 | 
         
            -
                            weight_name = gr.Dropdown(choices=find_weight_files(),
         
     | 
| 100 | 
         
            -
                                                           value='ReVersion/experiments/painted_on',
         
     | 
| 101 | 
         
            -
                                                           label='ReVersion/experiments/painted_on')
         
     | 
| 102 | 
         
            -
                            prompt = gr.Textbox(
         
     | 
| 103 | 
         
            -
                                label='Prompt',
         
     | 
| 104 | 
         
            -
                                max_lines=1,
         
     | 
| 105 | 
         
            -
                                placeholder='Example: "cat <R> stone"')
         
     | 
| 106 | 
         
            -
                            seed = gr.Slider(label='Seed',
         
     | 
| 107 | 
         
            -
                                             minimum=0,
         
     | 
| 108 | 
         
            -
                                             maximum=100000,
         
     | 
| 109 | 
         
            -
                                             step=1,
         
     | 
| 110 | 
         
            -
                                             value=42)
         
     | 
| 111 | 
         
            -
                            with gr.Accordion('Other Parameters', open=False):
         
     | 
| 112 | 
         
            -
                                num_steps = gr.Slider(label='Number of Steps',
         
     | 
| 113 | 
         
            -
                                                      minimum=0,
         
     | 
| 114 | 
         
            -
                                                      maximum=500,
         
     | 
| 115 | 
         
            -
                                                      step=1,
         
     | 
| 116 | 
         
            -
                                                      value=100)
         
     | 
| 117 | 
         
            -
                                guidance_scale = gr.Slider(label='CFG Scale',
         
     | 
| 118 | 
         
            -
                                                           minimum=0,
         
     | 
| 119 | 
         
            -
                                                           maximum=50,
         
     | 
| 120 | 
         
            -
                                                           step=0.1,
         
     | 
| 121 | 
         
            -
                                                           value=6)
         
     | 
| 122 | 
         
            -
                                eta = gr.Slider(label='DDIM eta',
         
     | 
| 123 | 
         
            -
                                                           minimum=0,
         
     | 
| 124 | 
         
            -
                                                           maximum=1.,
         
     | 
| 125 | 
         
            -
                                                           step=0.1,
         
     | 
| 126 | 
         
            -
                                                           value=1.)
         
     | 
| 127 | 
         
            -
                                batch_size = gr.Slider(label='Batch Size',
         
     | 
| 128 | 
         
            -
                                                           minimum=0,
         
     | 
| 129 | 
         
            -
                                                           maximum=10.,
         
     | 
| 130 | 
         
            -
                                                           step=1,
         
     | 
| 131 | 
         
            -
                                                           value=1)
         
     | 
| 132 | 
         
            -
             
     | 
| 133 | 
         
            -
                            run_button = gr.Button('Generate')
         
     | 
| 134 | 
         
            -
             
     | 
| 135 | 
         
            -
                            gr.Markdown('''
         
     | 
| 136 | 
         
            -
                            - Models with names starting with "custom-diffusion-models/" are the pretrained models provided in the [original repo](https://github.com/adobe-research/custom-diffusion), and the ones with names starting with "results/delta.bin" are your trained models.
         
     | 
| 137 | 
         
            -
                            - After training, you can press "Reload Weight List" button to load your trained model names.
         
     | 
| 138 | 
         
            -
                            - Increase number of steps in Other parameters for better samples qualitatively.
         
     | 
| 139 | 
         
            -
                            ''')
         
     | 
| 140 | 
         
            -
                        with gr.Column():
         
     | 
| 141 | 
         
            -
                            result = gr.Image(label='Result')
         
     | 
| 142 | 
         
            -
             
     | 
| 143 | 
         
            -
                    reload_button.click(fn=reload_custom_diffusion_weight_list,
         
     | 
| 144 | 
         
            -
                                        inputs=None,
         
     | 
| 145 | 
         
            -
                                        outputs=weight_name)
         
     | 
| 146 | 
         
            -
                    prompt.submit(fn=pipe.run,
         
     | 
| 147 | 
         
            -
                                  inputs=[
         
     | 
| 148 | 
         
            -
                                      base_model,
         
     | 
| 149 | 
         
            -
                                      weight_name,
         
     | 
| 150 | 
         
            -
                                      prompt,
         
     | 
| 151 | 
         
            -
                                      seed,
         
     | 
| 152 | 
         
            -
                                      num_steps,
         
     | 
| 153 | 
         
            -
                                      guidance_scale,
         
     | 
| 154 | 
         
            -
                                      eta,
         
     | 
| 155 | 
         
            -
                                      batch_size,
         
     | 
| 156 | 
         
            -
                                      resolution
         
     | 
| 157 | 
         
            -
                                  ],
         
     | 
| 158 | 
         
            -
                                  outputs=result,
         
     | 
| 159 | 
         
            -
                                  queue=False)
         
     | 
| 160 | 
         
            -
                    run_button.click(fn=pipe.run,
         
     | 
| 161 | 
         
            -
                                     inputs=[
         
     | 
| 162 | 
         
            -
                                         base_model,
         
     | 
| 163 | 
         
            -
                                         weight_name,
         
     | 
| 164 | 
         
            -
                                         prompt,
         
     | 
| 165 | 
         
            -
                                         seed,
         
     | 
| 166 | 
         
            -
                                         num_steps,
         
     | 
| 167 | 
         
            -
                                         guidance_scale,
         
     | 
| 168 | 
         
            -
                                         eta,
         
     | 
| 169 | 
         
            -
                                         batch_size,
         
     | 
| 170 | 
         
            -
                                         resolution
         
     | 
| 171 | 
         
            -
                                     ],
         
     | 
| 172 | 
         
            -
                                     outputs=result,
         
     | 
| 173 | 
         
            -
                                     queue=False)
         
     | 
| 174 | 
         
            -
                return demo
         
     | 
| 175 | 
         
            -
             
     | 
| 176 | 
         
            -
             
     | 
| 177 | 
         
            -
            pipe = InferencePipeline()
         
     | 
| 178 | 
         
            -
            trainer = Trainer()
         
     | 
| 179 | 
         
            -
             
     | 
| 180 | 
         
            -
            with gr.Blocks(css='style.css') as demo:
         
     | 
| 181 | 
         
            -
                if os.getenv('IS_SHARED_UI'):
         
     | 
| 182 | 
         
            -
                    show_warning(SHARED_UI_WARNING)
         
     | 
| 183 | 
         
            -
                if not torch.cuda.is_available():
         
     | 
| 184 | 
         
            -
                    show_warning(CUDA_NOT_AVAILABLE_WARNING)
         
     | 
| 185 | 
         
            -
             
     | 
| 186 | 
         
            -
                gr.Markdown(TITLE)
         
     | 
| 187 | 
         
            -
                gr.Markdown(DESCRIPTION)
         
     | 
| 188 | 
         
            -
                gr.Markdown(DETAILDESCRIPTION)
         
     | 
| 189 | 
         
            -
             
     | 
| 190 | 
         
            -
                with gr.Tabs():
         
     | 
| 191 | 
         
            -
                    # with gr.TabItem('Train'):
         
     | 
| 192 | 
         
            -
                    #     create_training_demo(trainer, pipe)
         
     | 
| 193 | 
         
            -
                    with gr.TabItem('Inference'):
         
     | 
| 194 | 
         
            -
                        create_inference_demo(pipe)
         
     | 
| 195 | 
         
            -
                    # with gr.TabItem('Upload'):
         
     | 
| 196 | 
         
            -
                    #     create_upload_demo()
         
     | 
| 197 | 
         
            -
             
     | 
| 198 | 
         
            -
            demo.queue(default_enabled=False).launch(share=False)
         
     | 
| 199 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
    	
        inference.py
    CHANGED
    
    | 
         @@ -21,7 +21,7 @@ from PIL import Image 
     | 
|
| 21 | 
         | 
| 22 | 
         
             
            # from diffusers import StableDiffusionPipeline
         
     | 
| 23 | 
         
             
            # sys.path.insert(0, './ReVersion')
         
     | 
| 24 | 
         
            -
            from templates.templates import inference_templates
         
     | 
| 25 | 
         | 
| 26 | 
         
             
            import math
         
     | 
| 27 | 
         | 
| 
         | 
|
| 21 | 
         | 
| 22 | 
         
             
            # from diffusers import StableDiffusionPipeline
         
     | 
| 23 | 
         
             
            # sys.path.insert(0, './ReVersion')
         
     | 
| 24 | 
         
            +
            # from templates.templates import inference_templates
         
     | 
| 25 | 
         | 
| 26 | 
         
             
            import math
         
     | 
| 27 | 
         |