Spaces:
Runtime error
Runtime error
Update app_main.py
Browse files- app_main.py +9 -12
app_main.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from diffusers import
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
|
@@ -8,19 +8,16 @@ from tempfile import NamedTemporaryFile
|
|
| 8 |
from pathlib import Path
|
| 9 |
|
| 10 |
Path("tmp").mkdir(exist_ok=True)
|
| 11 |
-
device = "
|
| 12 |
print(f"Device is {device}")
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
pipe.to(device)
|
| 20 |
-
if device == "cuda":
|
| 21 |
-
pipe.enable_xformers_memory_efficient_attention()
|
| 22 |
-
pipe.enable_model_cpu_offload()
|
| 23 |
-
|
| 24 |
|
| 25 |
def get_iframe(rgb_path: str, depth_path: str, viewer_mode: str = "6DOF"):
|
| 26 |
# buffered = BytesIO()
|
|
|
|
| 1 |
+
from optimum.habana.diffusers import GaudiDDIMScheduler, GaudiStableDiffusionLDM3DPipeline
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
|
|
|
| 8 |
from pathlib import Path
|
| 9 |
|
| 10 |
Path("tmp").mkdir(exist_ok=True)
|
| 11 |
+
device = "hpu"
|
| 12 |
print(f"Device is {device}")
|
| 13 |
+
model_name = "Intel/ldm3d-pano"
|
| 14 |
+
scheduler = GaudiDDIMScheduler.from_pretrained(model_name, subfolder="scheduler")
|
| 15 |
+
pipe = GaudiStableDiffusionLDM3DPipeline.from_pretrained( model_name,
|
| 16 |
+
scheduler=scheduler,
|
| 17 |
+
use_habana=True,
|
| 18 |
+
use_hpu_graphs=True,
|
| 19 |
+
gaudi_config="Habana/stable-diffusion")
|
| 20 |
pipe.to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
def get_iframe(rgb_path: str, depth_path: str, viewer_mode: str = "6DOF"):
|
| 23 |
# buffered = BytesIO()
|