Random genre selection if none has been selected.

#2
by CarlosMN - opened
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -44,6 +44,10 @@ def main():
44
  code = genres_dict[genre]
45
  cond[code-1] = code
46
 
 
 
 
 
47
  def callback(image, progress):
48
  image = DiffusionImageAPI(None).tensor_to_image(image.squeeze(0))
49
  img_buffer = io.BytesIO()
 
44
  code = genres_dict[genre]
45
  cond[code-1] = code
46
 
47
+ if torch.any(cond != 0):
48
+ random_number = torch.randint(0, 13, (1,)).item()
49
+ cond[random_number] = random_number + 1
50
+
51
  def callback(image, progress):
52
  image = DiffusionImageAPI(None).tensor_to_image(image.squeeze(0))
53
  img_buffer = io.BytesIO()