Vedansh-7 commited on
Commit
58c11f3
·
verified ·
1 Parent(s): 66eb507

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,7 +7,7 @@ import math
7
  import os
8
  from threading import Event
9
  import traceback
10
- import cv2
11
 
12
  # Constants
13
  IMG_SIZE = 128
@@ -165,7 +165,7 @@ class DiffusionModel(nn.Module):
165
  else:
166
  labels = labels.to(device)
167
 
168
- # ---- REVERTED SAMPLING LOOP WITH NOISE REDUCTION ----
169
  for t in reversed(range(self.timesteps)):
170
  if cancel_event.is_set():
171
  return None
@@ -199,7 +199,7 @@ class DiffusionModel(nn.Module):
199
  x_0 = std * x_0 + mean
200
  x_0 = torch.clamp(x_0, 0., 1.)
201
 
202
- # ---- ENHANCED SHARPENING ----
203
  # First apply mild bilateral filtering to reduce noise while preserving edges
204
  x_np = x_0.cpu().permute(0, 2, 3, 1).numpy()
205
  filtered = []
 
7
  import os
8
  from threading import Event
9
  import traceback
10
+ import cv2 # Added for bilateral filtering
11
 
12
  # Constants
13
  IMG_SIZE = 128
 
165
  else:
166
  labels = labels.to(device)
167
 
168
+ # REVERTED SAMPLING LOOP WITH NOISE REDUCTION
169
  for t in reversed(range(self.timesteps)):
170
  if cancel_event.is_set():
171
  return None
 
199
  x_0 = std * x_0 + mean
200
  x_0 = torch.clamp(x_0, 0., 1.)
201
 
202
+ # ENHANCED SHARPENING
203
  # First apply mild bilateral filtering to reduce noise while preserving edges
204
  x_np = x_0.cpu().permute(0, 2, 3, 1).numpy()
205
  filtered = []