Spaces:
Running
Running
Commit
·
7aff61f
1
Parent(s):
94b31be
update
Browse files- gradio_demo/app.py +6 -2
gradio_demo/app.py
CHANGED
@@ -45,14 +45,18 @@ hf_hub_download(repo_id="InstantX/InstantIR", filename="models/previewer_lora_we
|
|
45 |
|
46 |
instantir_path = f'./models'
|
47 |
|
48 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
49 |
sdxl_repo_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
50 |
dinov2_repo_id = "facebook/dinov2-large"
|
51 |
lcm_repo_id = "latent-consistency/lcm-lora-sdxl"
|
52 |
|
53 |
if torch.cuda.is_available():
|
|
|
54 |
torch_dtype = torch.float16
|
|
|
|
|
|
|
55 |
else:
|
|
|
56 |
torch_dtype = torch.float32
|
57 |
|
58 |
# Load pretrained models.
|
@@ -262,4 +266,4 @@ with gr.Blocks() as demo:
|
|
262 |
```
|
263 |
""")
|
264 |
|
265 |
-
demo.queue().launch()
|
|
|
45 |
|
46 |
instantir_path = f'./models'
|
47 |
|
|
|
48 |
sdxl_repo_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
49 |
dinov2_repo_id = "facebook/dinov2-large"
|
50 |
lcm_repo_id = "latent-consistency/lcm-lora-sdxl"
|
51 |
|
52 |
if torch.cuda.is_available():
|
53 |
+
device = "cuda"
|
54 |
torch_dtype = torch.float16
|
55 |
+
elif torch.backends.mps.is_available():
|
56 |
+
device = "mps"
|
57 |
+
torch_dtype = torch.float32
|
58 |
else:
|
59 |
+
device = "cpu"
|
60 |
torch_dtype = torch.float32
|
61 |
|
62 |
# Load pretrained models.
|
|
|
266 |
```
|
267 |
""")
|
268 |
|
269 |
+
demo.queue().launch()
|