Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -28,14 +28,15 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
|
28 |
)
|
29 |
pipe.to("cuda")
|
30 |
|
31 |
-
custom_model = "fffiloni/eugene_decors_jour"
|
32 |
-
|
33 |
-
# This is where you load your trained weights
|
34 |
-
pipe.load_lora_weights(custom_model, weight_name="pytorch_lora_weights.safetensors", use_auth_token=True)
|
35 |
|
36 |
#pipe.enable_model_cpu_offload()
|
37 |
|
38 |
-
def infer(image_in, prompt, controlnet_conditioning_scale, guidance_scale):
|
|
|
|
|
|
|
|
|
|
|
39 |
prompt = prompt
|
40 |
negative_prompt = ""
|
41 |
|
@@ -58,6 +59,7 @@ def infer(image_in, prompt, controlnet_conditioning_scale, guidance_scale):
|
|
58 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
59 |
guidance_scale = guidance_scale,
|
60 |
num_inference_steps=50,
|
|
|
61 |
cross_attention_kwargs={"scale": lora_scale}
|
62 |
).images
|
63 |
|
@@ -67,16 +69,19 @@ def infer(image_in, prompt, controlnet_conditioning_scale, guidance_scale):
|
|
67 |
|
68 |
with gr.Blocks() as demo:
|
69 |
with gr.Column():
|
|
|
70 |
image_in = gr.Image(source="upload", type="filepath")
|
71 |
prompt = gr.Textbox(label="Prompt")
|
72 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=10.0, step=0.1, value=7.5, type="float")
|
73 |
controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=0.9, step=0.01, value=0.5, type="float")
|
|
|
|
|
74 |
submit_btn = gr.Button("Submit")
|
75 |
result = gr.Image(label="Result")
|
76 |
|
77 |
submit_btn.click(
|
78 |
fn = infer,
|
79 |
-
inputs = [image_in, prompt, controlnet_conditioning_scale, guidance_scale ],
|
80 |
outputs = [result]
|
81 |
)
|
82 |
|
|
|
28 |
)
|
29 |
pipe.to("cuda")
|
30 |
|
|
|
|
|
|
|
|
|
31 |
|
32 |
#pipe.enable_model_cpu_offload()
|
33 |
|
34 |
+
def infer(model_name, image_in, prompt, controlnet_conditioning_scale, guidance_scale, seed):
|
35 |
+
custom_model = model_name
|
36 |
+
|
37 |
+
# This is where you load your trained weights
|
38 |
+
pipe.load_lora_weights(custom_model, weight_name="pytorch_lora_weights.safetensors", use_auth_token=True)
|
39 |
+
|
40 |
prompt = prompt
|
41 |
negative_prompt = ""
|
42 |
|
|
|
59 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
60 |
guidance_scale = guidance_scale,
|
61 |
num_inference_steps=50,
|
62 |
+
seed=seed,
|
63 |
cross_attention_kwargs={"scale": lora_scale}
|
64 |
).images
|
65 |
|
|
|
69 |
|
70 |
with gr.Blocks() as demo:
|
71 |
with gr.Column():
|
72 |
+
model_name = gr.Textbox(label="Model to use", placeholder="username/my_model"
|
73 |
image_in = gr.Image(source="upload", type="filepath")
|
74 |
prompt = gr.Textbox(label="Prompt")
|
75 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=10.0, step=0.1, value=7.5, type="float")
|
76 |
controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=0.9, step=0.01, value=0.5, type="float")
|
77 |
+
seed = gr.Slider(label="seed", minimum=0, maximum=500000, step=1, value=42)
|
78 |
+
|
79 |
submit_btn = gr.Button("Submit")
|
80 |
result = gr.Image(label="Result")
|
81 |
|
82 |
submit_btn.click(
|
83 |
fn = infer,
|
84 |
+
inputs = [model_name, image_in, prompt, controlnet_conditioning_scale, guidance_scale, seed],
|
85 |
outputs = [result]
|
86 |
)
|
87 |
|