Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,8 @@ pipe = DiffusionPipeline.from_pretrained(
|
|
| 18 |
|
| 19 |
device="cuda" if torch.cuda.is_available() else "cpu"
|
| 20 |
|
|
|
|
|
|
|
| 21 |
def load_model(custom_model, weight_name):
|
| 22 |
|
| 23 |
if custom_model == "":
|
|
@@ -26,7 +28,6 @@ def load_model(custom_model, weight_name):
|
|
| 26 |
|
| 27 |
# This is where you load your trained weights
|
| 28 |
pipe.load_lora_weights(custom_model, weight_name=weight_name, use_auth_token=True)
|
| 29 |
-
pipe.to(device)
|
| 30 |
|
| 31 |
return "Model loaded!"
|
| 32 |
|
|
@@ -37,7 +38,7 @@ def infer (prompt, inf_steps, guidance_scale, seed, lora_weight, progress=gr.Pro
|
|
| 37 |
image = pipe(
|
| 38 |
prompt=prompt,
|
| 39 |
num_inference_steps=inf_steps,
|
| 40 |
-
guidance_scale =
|
| 41 |
generator=generator,
|
| 42 |
cross_attention_kwargs={"scale": lora_weight}
|
| 43 |
).images[0]
|
|
|
|
| 18 |
|
| 19 |
device="cuda" if torch.cuda.is_available() else "cpu"
|
| 20 |
|
| 21 |
+
pipe.to(device)
|
| 22 |
+
|
| 23 |
def load_model(custom_model, weight_name):
|
| 24 |
|
| 25 |
if custom_model == "":
|
|
|
|
| 28 |
|
| 29 |
# This is where you load your trained weights
|
| 30 |
pipe.load_lora_weights(custom_model, weight_name=weight_name, use_auth_token=True)
|
|
|
|
| 31 |
|
| 32 |
return "Model loaded!"
|
| 33 |
|
|
|
|
| 38 |
image = pipe(
|
| 39 |
prompt=prompt,
|
| 40 |
num_inference_steps=inf_steps,
|
| 41 |
+
guidance_scale = guidance_scale,
|
| 42 |
generator=generator,
|
| 43 |
cross_attention_kwargs={"scale": lora_weight}
|
| 44 |
).images[0]
|