Spaces:
Runtime error
Runtime error
feat: clear image cache
Browse files
app.py
CHANGED
@@ -45,14 +45,26 @@ with style_image:
|
|
45 |
StyleColumnTitle, StyleImageSelectionPrompt, "Style", "style"
|
46 |
)
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
StyleColumnTitle, StyleImageSelectionPrompt, "Style", "style"
|
46 |
)
|
47 |
|
48 |
+
if None not in (content_image_file, style_image_file):
|
49 |
+
|
50 |
+
# CLEAR IMAGES
|
51 |
+
clear_images = st.button(
|
52 |
+
label="πβ Clear Image Cache βπ",
|
53 |
+
on_click=remove_source_images(),
|
54 |
+
)
|
55 |
+
|
56 |
+
# STYLIZE CONTENT IMAGE
|
57 |
+
stylize_image = st.button("πΌοΈποΈπ¨ Start Neural Style Transfer πΌοΈποΈπ¨")
|
58 |
+
|
59 |
+
if stylize_image:
|
60 |
+
final_image = stylize_content_image(model, content_image_file, style_image_file)
|
61 |
+
st.write("# Styled Image:")
|
62 |
+
st.image(final_image)
|
63 |
+
try:
|
64 |
+
remove_source_images()
|
65 |
+
except:
|
66 |
+
pass
|
67 |
+
|
68 |
+
|
69 |
+
else:
|
70 |
+
st.write("Please upload content and style image to go to next step.")
|