Spaces:
Sleeping
Sleeping
Update app.py
Browse files- Update error with downloading everytime model when runs generation;
- Update look of 3DSkinView for mobile devices;
app.py
CHANGED
|
@@ -13,7 +13,6 @@ from io import BytesIO
|
|
| 13 |
|
| 14 |
device = ("mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu")
|
| 15 |
|
| 16 |
-
|
| 17 |
class MSPipeline(DiffusionPipeline):
|
| 18 |
def __init__(self, unet, scheduler):
|
| 19 |
super().__init__()
|
|
@@ -36,6 +35,9 @@ class MSPipeline(DiffusionPipeline):
|
|
| 36 |
return x
|
| 37 |
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
def clear_pix(x):
|
| 40 |
datas = []
|
| 41 |
for pixel in list(x.getdata()):
|
|
@@ -67,8 +69,6 @@ def show_3D(image, print_link = False):
|
|
| 67 |
|
| 68 |
|
| 69 |
def generate(schedulers, inference_steps, images_num):
|
| 70 |
-
pipe = MSPipeline.from_pretrained("WiNE-iNEFF/Mineskin-Diffusion-v1.0", use_safetensors=True).to(device)
|
| 71 |
-
|
| 72 |
if schedulers == "DDIMScheduler":
|
| 73 |
pipe.scheduler = DDIMScheduler.from_pretrained("WiNE-iNEFF/Mineskin-Diffusion-v1.0", subfolder="scheduler")
|
| 74 |
elif schedulers == "DDPMScheduler":
|
|
@@ -87,7 +87,7 @@ def generate(schedulers, inference_steps, images_num):
|
|
| 87 |
|
| 88 |
|
| 89 |
def update_iframe(images):
|
| 90 |
-
iframe_html = "<div style='display: grid; grid-template-columns: repeat(2, 1fr);
|
| 91 |
for img in images:
|
| 92 |
iframe_url = show_3D(clear_pix(img), print_link=True)
|
| 93 |
iframe_html += f"<iframe style='min-width: 100%;' src='{iframe_url}'></iframe>"
|
|
|
|
| 13 |
|
| 14 |
device = ("mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu")
|
| 15 |
|
|
|
|
| 16 |
class MSPipeline(DiffusionPipeline):
|
| 17 |
def __init__(self, unet, scheduler):
|
| 18 |
super().__init__()
|
|
|
|
| 35 |
return x
|
| 36 |
|
| 37 |
|
| 38 |
+
pipe = MSPipeline.from_pretrained("WiNE-iNEFF/Mineskin-Diffusion-v1.0", use_safetensors=True).to(device)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
def clear_pix(x):
|
| 42 |
datas = []
|
| 43 |
for pixel in list(x.getdata()):
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
def generate(schedulers, inference_steps, images_num):
|
|
|
|
|
|
|
| 72 |
if schedulers == "DDIMScheduler":
|
| 73 |
pipe.scheduler = DDIMScheduler.from_pretrained("WiNE-iNEFF/Mineskin-Diffusion-v1.0", subfolder="scheduler")
|
| 74 |
elif schedulers == "DDPMScheduler":
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
def update_iframe(images):
|
| 90 |
+
iframe_html = "<div style='display: grid; gap: 10px'>" #grid-template-columns: repeat(2, 1fr);
|
| 91 |
for img in images:
|
| 92 |
iframe_url = show_3D(clear_pix(img), print_link=True)
|
| 93 |
iframe_html += f"<iframe style='min-width: 100%;' src='{iframe_url}'></iframe>"
|