Spaces:
Running
on
Zero
Running
on
Zero
Alexander Bagus
commited on
Commit
·
d6ca753
1
Parent(s):
00842ed
22
Browse files
app.py
CHANGED
|
@@ -61,14 +61,15 @@ pipe = QwenImagePipeline.from_pretrained(
|
|
| 61 |
|
| 62 |
@spaces.GPU
|
| 63 |
def generate_lora(
|
| 64 |
-
|
| 65 |
progress=gr.Progress(track_tqdm=True),
|
| 66 |
):
|
| 67 |
|
| 68 |
ulid = str(ULID()).lower()[:12]
|
| 69 |
print(f"ulid: {ulid}")
|
| 70 |
|
| 71 |
-
|
|
|
|
| 72 |
print("images is empty.")
|
| 73 |
# Load images
|
| 74 |
# images = [
|
|
@@ -82,7 +83,7 @@ def generate_lora(
|
|
| 82 |
|
| 83 |
# Model inference
|
| 84 |
with torch.no_grad():
|
| 85 |
-
embs = QwenImageUnit_Image2LoRAEncode().process(pipe, image2lora_images=
|
| 86 |
lora = QwenImageUnit_Image2LoRADecode().process(pipe, **embs)["lora"]
|
| 87 |
|
| 88 |
lora_name = f"{ulid}.safetensors"
|
|
|
|
| 61 |
|
| 62 |
@spaces.GPU
|
| 63 |
def generate_lora(
|
| 64 |
+
input_images,
|
| 65 |
progress=gr.Progress(track_tqdm=True),
|
| 66 |
):
|
| 67 |
|
| 68 |
ulid = str(ULID()).lower()[:12]
|
| 69 |
print(f"ulid: {ulid}")
|
| 70 |
|
| 71 |
+
input_images = list(input_images)
|
| 72 |
+
if not input_images:
|
| 73 |
print("images is empty.")
|
| 74 |
# Load images
|
| 75 |
# images = [
|
|
|
|
| 83 |
|
| 84 |
# Model inference
|
| 85 |
with torch.no_grad():
|
| 86 |
+
embs = QwenImageUnit_Image2LoRAEncode().process(pipe, image2lora_images=input_images)
|
| 87 |
lora = QwenImageUnit_Image2LoRADecode().process(pipe, **embs)["lora"]
|
| 88 |
|
| 89 |
lora_name = f"{ulid}.safetensors"
|