Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -272,15 +272,16 @@ def infer(ref_style_file, style_description, caption):
|
|
| 272 |
# Reset the state after inference, regardless of success or failure
|
| 273 |
reset_inference_state()
|
| 274 |
|
| 275 |
-
def transform(
|
| 276 |
"""
|
| 277 |
Define the necessary transformations for the image.
|
| 278 |
"""
|
|
|
|
| 279 |
return T.Compose([
|
| 280 |
T.Resize((256, 256)), # Example resize, adjust as needed
|
| 281 |
T.ToTensor(),
|
| 282 |
T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
| 283 |
-
])(
|
| 284 |
|
| 285 |
def infer_compo(style_description, ref_style_file, caption, ref_sub_file):
|
| 286 |
global models_rbm, models_b
|
|
|
|
| 272 |
# Reset the state after inference, regardless of success or failure
|
| 273 |
reset_inference_state()
|
| 274 |
|
| 275 |
+
def transform(tensor):
|
| 276 |
"""
|
| 277 |
Define the necessary transformations for the image.
|
| 278 |
"""
|
| 279 |
+
to_pil = T.ToPILImage()
|
| 280 |
return T.Compose([
|
| 281 |
T.Resize((256, 256)), # Example resize, adjust as needed
|
| 282 |
T.ToTensor(),
|
| 283 |
T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
| 284 |
+
])(to_pil(tensor))
|
| 285 |
|
| 286 |
def infer_compo(style_description, ref_style_file, caption, ref_sub_file):
|
| 287 |
global models_rbm, models_b
|