Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,15 +3,14 @@ import numpy as np
|
|
| 3 |
import random
|
| 4 |
import spaces
|
| 5 |
import torch
|
| 6 |
-
from diffusers import
|
| 7 |
|
| 8 |
dtype = torch.bfloat16
|
| 9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 10 |
|
| 11 |
|
| 12 |
-
|
| 13 |
# Load the model pipeline
|
| 14 |
-
pipe =
|
| 15 |
|
| 16 |
torch.cuda.empty_cache()
|
| 17 |
|
|
@@ -30,8 +29,7 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidan
|
|
| 30 |
if lora_id and lora_id.strip() != "":
|
| 31 |
pipe.unload_lora_weights()
|
| 32 |
pipe.load_lora_weights(lora_id.strip())
|
| 33 |
-
|
| 34 |
-
|
| 35 |
try:
|
| 36 |
image = pipe(
|
| 37 |
prompt=prompt,
|
|
|
|
| 3 |
import random
|
| 4 |
import spaces
|
| 5 |
import torch
|
| 6 |
+
from diffusers import DiffusionPipeline
|
| 7 |
|
| 8 |
dtype = torch.bfloat16
|
| 9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 10 |
|
| 11 |
|
|
|
|
| 12 |
# Load the model pipeline
|
| 13 |
+
pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image", torch_dtype=dtype).to(device)
|
| 14 |
|
| 15 |
torch.cuda.empty_cache()
|
| 16 |
|
|
|
|
| 29 |
if lora_id and lora_id.strip() != "":
|
| 30 |
pipe.unload_lora_weights()
|
| 31 |
pipe.load_lora_weights(lora_id.strip())
|
| 32 |
+
|
|
|
|
| 33 |
try:
|
| 34 |
image = pipe(
|
| 35 |
prompt=prompt,
|