Darius Morawiec commited on
Commit
9757b8b
·
1 Parent(s): 02e527d

Refactor precision handling and improve user feedback for CUDA availability

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import shutil
2
  import time
3
  from pathlib import Path
4
- from xml.parsers.expat import model
5
 
6
  import cv2
7
  import gradio as gr
@@ -17,7 +16,8 @@ from nunchaku.utils import get_gpu_memory, get_precision
17
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
18
 
19
  RANK = 128
20
- TRANSFORMER_ID = f"nunchaku-tech/nunchaku-qwen-image-edit-2509/svdq-{get_precision(device='cpu')}_r{RANK}-qwen-image-edit-2509.safetensors"
 
21
  PIPELINE_ID = "Qwen/Qwen-Image-Edit-2509"
22
 
23
  IMAGE_SIZE = 1024
@@ -167,7 +167,14 @@ class Model:
167
 
168
 
169
  with gr.Blocks() as demo:
170
- gr.Markdown("# Nunchaku Qwen-Image-Edit-2509")
 
 
 
 
 
 
 
171
 
172
  with gr.Row():
173
  with gr.Column():
 
1
  import shutil
2
  import time
3
  from pathlib import Path
 
4
 
5
  import cv2
6
  import gradio as gr
 
16
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
17
 
18
  RANK = 128
19
+ PRECISION = get_precision() if DEVICE == "cuda" else "fp4"
20
+ TRANSFORMER_ID = f"nunchaku-tech/nunchaku-qwen-image-edit-2509/svdq-{PRECISION}_r{RANK}-qwen-image-edit-2509.safetensors"
21
  PIPELINE_ID = "Qwen/Qwen-Image-Edit-2509"
22
 
23
  IMAGE_SIZE = 1024
 
167
 
168
 
169
  with gr.Blocks() as demo:
170
+ title = gr.Markdown("# Nunchaku Qwen-Image-Edit-2509")
171
+
172
+ gr.Markdown("You can clone this repository or duplicate this space.")
173
+
174
+ if DEVICE != "cuda":
175
+ gr.Markdown(
176
+ "⚠️ **CUDA not available.** This application requires a CUDA-compatible GPU to function properly."
177
+ )
178
 
179
  with gr.Row():
180
  with gr.Column():