Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ generator = torch.Generator(device="cuda")
|
|
31 |
|
32 |
#pipe.enable_model_cpu_offload()
|
33 |
|
34 |
-
def infer(use_custom_model, model_name, image_in, prompt, negative_prompt, preprocessor, controlnet_conditioning_scale, guidance_scale, seed):
|
35 |
if use_custom_model:
|
36 |
custom_model = model_name
|
37 |
|
@@ -52,7 +52,7 @@ def infer(use_custom_model, model_name, image_in, prompt, negative_prompt, prepr
|
|
52 |
image = Image.fromarray(image)
|
53 |
|
54 |
if use_custom_model:
|
55 |
-
lora_scale=
|
56 |
|
57 |
images = pipe(
|
58 |
prompt,
|
@@ -93,8 +93,7 @@ with gr.Blocks(css=css) as demo:
|
|
93 |
Use StableDiffusion XL with ControlNet pretrained LoRas
|
94 |
|
95 |
""")
|
96 |
-
|
97 |
-
model_name = gr.Textbox(label="Custom Model to use", placeholder="username/my_custom_public_model")
|
98 |
image_in = gr.Image(source="upload", type="filepath")
|
99 |
with gr.Row():
|
100 |
with gr.Column():
|
@@ -105,13 +104,15 @@ Use StableDiffusion XL with ControlNet pretrained LoRas
|
|
105 |
preprocessor = gr.Dropdown(label="Preprocessor", choices=["canny"], value="canny", interactive=False, info="For the moment, only canny is available")
|
106 |
controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=0.9, step=0.01, value=0.5, type="float")
|
107 |
seed = gr.Slider(label="seed", minimum=0, maximum=500000, step=1, value=42)
|
108 |
-
|
|
|
|
|
109 |
submit_btn = gr.Button("Submit")
|
110 |
result = gr.Image(label="Result")
|
111 |
|
112 |
submit_btn.click(
|
113 |
fn = infer,
|
114 |
-
inputs = [use_custom_model, model_name, image_in, prompt, negative_prompt, preprocessor, controlnet_conditioning_scale, guidance_scale, seed],
|
115 |
outputs = [result]
|
116 |
)
|
117 |
|
|
|
31 |
|
32 |
#pipe.enable_model_cpu_offload()
|
33 |
|
34 |
+
def infer(use_custom_model, model_name, custom_lora_weight, image_in, prompt, negative_prompt, preprocessor, controlnet_conditioning_scale, guidance_scale, seed):
|
35 |
if use_custom_model:
|
36 |
custom_model = model_name
|
37 |
|
|
|
52 |
image = Image.fromarray(image)
|
53 |
|
54 |
if use_custom_model:
|
55 |
+
lora_scale=custom_lora_weight
|
56 |
|
57 |
images = pipe(
|
58 |
prompt,
|
|
|
93 |
Use StableDiffusion XL with ControlNet pretrained LoRas
|
94 |
|
95 |
""")
|
96 |
+
|
|
|
97 |
image_in = gr.Image(source="upload", type="filepath")
|
98 |
with gr.Row():
|
99 |
with gr.Column():
|
|
|
104 |
preprocessor = gr.Dropdown(label="Preprocessor", choices=["canny"], value="canny", interactive=False, info="For the moment, only canny is available")
|
105 |
controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=0.9, step=0.01, value=0.5, type="float")
|
106 |
seed = gr.Slider(label="seed", minimum=0, maximum=500000, step=1, value=42)
|
107 |
+
use_custom_model = gr.Checkbox(label="Use a public custom model ?(optional)", value=False, info="To use a private model, you'll prefer to duplicate the space with your own access token.")
|
108 |
+
model_name = gr.Textbox(label="Custom Model to use", placeholder="username/my_custom_public_model")
|
109 |
+
custom_lora_weight = gr.Slider(label="Custom weights", minimum=0.1, maximum=0.9, step=0.1, value=0.9)
|
110 |
submit_btn = gr.Button("Submit")
|
111 |
result = gr.Image(label="Result")
|
112 |
|
113 |
submit_btn.click(
|
114 |
fn = infer,
|
115 |
+
inputs = [use_custom_model, model_name, custom_lora_weight, image_in, prompt, negative_prompt, preprocessor, controlnet_conditioning_scale, guidance_scale, seed],
|
116 |
outputs = [result]
|
117 |
)
|
118 |
|