Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
import time
|
3 |
-
import datetime
|
4 |
from tqdm import tqdm
|
5 |
|
6 |
import spaces
|
@@ -64,7 +64,7 @@ def compute_loss(generated_features, content_features, style_features, alpha, be
|
|
64 |
def inference(content_image, style_name, style_strength, output_quality, progress=gr.Progress(track_tqdm=True)):
|
65 |
yield None
|
66 |
print('-'*15)
|
67 |
-
print('DATETIME:', datetime.
|
68 |
print('STYLE:', style_name)
|
69 |
|
70 |
img_size = 1024 if output_quality else 512
|
|
|
1 |
import os
|
2 |
import time
|
3 |
+
from datetime import datetime, timezone, timedelta
|
4 |
from tqdm import tqdm
|
5 |
|
6 |
import spaces
|
|
|
64 |
def inference(content_image, style_name, style_strength, output_quality, progress=gr.Progress(track_tqdm=True)):
|
65 |
yield None
|
66 |
print('-'*15)
|
67 |
+
print('DATETIME:', datetime.now(timezone.utc) - timedelta(hours=4))
|
68 |
print('STYLE:', style_name)
|
69 |
|
70 |
img_size = 1024 if output_quality else 512
|
utils.py
CHANGED
@@ -24,9 +24,6 @@ def postprocess_img(img, original_size):
|
|
24 |
img = torch.clamp(img, 0, 1)
|
25 |
img = img.mul(255).byte()
|
26 |
|
27 |
-
|
28 |
-
img = unloader(img)
|
29 |
-
|
30 |
img = img.resize(original_size, Image.Resampling.LANCZOS)
|
31 |
-
|
32 |
return img
|
|
|
24 |
img = torch.clamp(img, 0, 1)
|
25 |
img = img.mul(255).byte()
|
26 |
|
27 |
+
img = transforms.ToPILImage()(img)
|
|
|
|
|
28 |
img = img.resize(original_size, Image.Resampling.LANCZOS)
|
|
|
29 |
return img
|