Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ for style_name, style_img_path in style_options.items():
|
|
40 |
cached_style_features[style_name] = style_features
|
41 |
|
42 |
@spaces.GPU(duration=12)
|
43 |
-
def run(content_image, style_name, style_strength=5
|
44 |
yield None, None
|
45 |
content_img, original_size = preprocess_img(content_image, img_size)
|
46 |
content_img = content_img.to(device)
|
@@ -70,13 +70,10 @@ def run(content_image, style_name, style_strength=5, progress=gr.Progress(total=
|
|
70 |
)
|
71 |
|
72 |
with ThreadPoolExecutor() as executor:
|
73 |
-
progress(0, desc='Styling image')
|
74 |
future_all = executor.submit(run_inference, False, stream_all)
|
75 |
-
progress(1, desc='Styling background')
|
76 |
future_bg = executor.submit(run_inference, True, stream_bg)
|
77 |
generated_img_all = future_all.result()
|
78 |
generated_img_bg = future_bg.result()
|
79 |
-
progress(2)
|
80 |
|
81 |
et = time.time()
|
82 |
print('TIME TAKEN:', et-st)
|
|
|
40 |
cached_style_features[style_name] = style_features
|
41 |
|
42 |
@spaces.GPU(duration=12)
|
43 |
+
def run(content_image, style_name, style_strength=5):
|
44 |
yield None, None
|
45 |
content_img, original_size = preprocess_img(content_image, img_size)
|
46 |
content_img = content_img.to(device)
|
|
|
70 |
)
|
71 |
|
72 |
with ThreadPoolExecutor() as executor:
|
|
|
73 |
future_all = executor.submit(run_inference, False, stream_all)
|
|
|
74 |
future_bg = executor.submit(run_inference, True, stream_bg)
|
75 |
generated_img_all = future_all.result()
|
76 |
generated_img_bg = future_bg.result()
|
|
|
77 |
|
78 |
et = time.time()
|
79 |
print('TIME TAKEN:', et-st)
|