Spaces:
Paused
Paused
Random genre selection if none has been selected. (#2)
Browse files- Random genre selection if none has been selected. (5140c811ae4e6bc3166cd62f75d61e8322346975)
Co-authored-by: Carlos Marí Noguera <CarlosMN@users.noreply.huggingface.co>
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()
|