Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -337,6 +337,9 @@ def infer_compo(style_description, ref_style_file, caption, ref_sub_file, progre
|
|
337 |
# Remove the batch dimension and keep only the generated image
|
338 |
sampled = sampled[2] # This selects the generated image, discarding the reference images
|
339 |
|
|
|
|
|
|
|
340 |
# Ensure the tensor is in [C, H, W] format
|
341 |
if sampled.dim() == 3 and sampled.shape[0] == 3:
|
342 |
sampled_image = T.ToPILImage()(sampled) # Convert tensor to PIL image
|
|
|
337 |
# Remove the batch dimension and keep only the generated image
|
338 |
sampled = sampled[2] # This selects the generated image, discarding the reference images
|
339 |
|
340 |
+
# Ensure the tensor values are in the correct range
|
341 |
+
sampled = torch.clamp(sampled, 0, 1)
|
342 |
+
|
343 |
# Ensure the tensor is in [C, H, W] format
|
344 |
if sampled.dim() == 3 and sampled.shape[0] == 3:
|
345 |
sampled_image = T.ToPILImage()(sampled) # Convert tensor to PIL image
|