Spaces:
Sleeping
Sleeping
Alexander Bagus commited on
Commit ·
8a1cbae
1
Parent(s): c8a5fa7
update torch version
Browse files- app.py +11 -2
- requirements.txt +2 -1
- static/header.html +2 -2
app.py
CHANGED
|
@@ -158,7 +158,7 @@ pipe_imagen = ZImagePipeline.from_pretrained(
|
|
| 158 |
pipe_imagen.to("cuda")
|
| 159 |
|
| 160 |
|
| 161 |
-
@spaces.GPU
|
| 162 |
def generate_lora(
|
| 163 |
input_images,
|
| 164 |
progress=gr.Progress(track_tqdm=True),
|
|
@@ -173,7 +173,16 @@ def generate_lora(
|
|
| 173 |
|
| 174 |
progress(0.1, desc="Processing images...")
|
| 175 |
print("progress: step 1")
|
| 176 |
-
pil_images = [Image.open(filepath).convert("RGB") for filepath, _ in input_images]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
progress(0.3, desc="Encoding images to LoRA...")
|
| 179 |
print("progress: step 2")
|
|
|
|
| 158 |
pipe_imagen.to("cuda")
|
| 159 |
|
| 160 |
|
| 161 |
+
@spaces.GPU(duration=120)
|
| 162 |
def generate_lora(
|
| 163 |
input_images,
|
| 164 |
progress=gr.Progress(track_tqdm=True),
|
|
|
|
| 173 |
|
| 174 |
progress(0.1, desc="Processing images...")
|
| 175 |
print("progress: step 1")
|
| 176 |
+
# pil_images = [Image.open(filepath).convert("RGB") for filepath, _ in input_images]
|
| 177 |
+
|
| 178 |
+
pil_images = []
|
| 179 |
+
for img in input_images:
|
| 180 |
+
if isinstance(img, str):
|
| 181 |
+
pil_images.append(Image.open(img).convert("RGB"))
|
| 182 |
+
elif isinstance(img, tuple):
|
| 183 |
+
pil_images.append(Image.open(img[0]).convert("RGB"))
|
| 184 |
+
else:
|
| 185 |
+
pil_images.append(Image.fromarray(img).convert("RGB"))
|
| 186 |
|
| 187 |
progress(0.3, desc="Encoding images to LoRA...")
|
| 188 |
print("progress: step 2")
|
requirements.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
gradio
|
| 2 |
-
torch
|
|
|
|
| 3 |
transformers
|
| 4 |
accelerate
|
| 5 |
spaces
|
|
|
|
| 1 |
gradio
|
| 2 |
+
torch==2.8.0
|
| 3 |
+
torchvision
|
| 4 |
transformers
|
| 5 |
accelerate
|
| 6 |
spaces
|
static/header.html
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
<div style="text-align: center; max-width: 600px; margin: 0 auto;">
|
| 2 |
<h1>
|
| 3 |
-
|
| 4 |
</h1>
|
| 5 |
<div class="grid-container" >
|
| 6 |
<p>
|
| 7 |
Generate LoRA from a few images.
|
| 8 |
<br>
|
| 9 |
-
Demo by <a href="https://aisudo.com/" target="_blank">AiSudo</a> 😊
|
| 10 |
</div>
|
| 11 |
</div>
|
|
|
|
| 1 |
<div style="text-align: center; max-width: 600px; margin: 0 auto;">
|
| 2 |
<h1>
|
| 3 |
+
Z Image to LoRA
|
| 4 |
</h1>
|
| 5 |
<div class="grid-container" >
|
| 6 |
<p>
|
| 7 |
Generate LoRA from a few images.
|
| 8 |
<br>
|
| 9 |
+
Demo by <a href="https://aisudo.com/" target="_blank">AiSudo</a> 😊
|
| 10 |
</div>
|
| 11 |
</div>
|