pkiage commited on
Commit
5d9b5ae
β€’
1 Parent(s): 732b57d

feat: clear image cache

Browse files
Files changed (1) hide show
  1. app.py +23 -11
app.py CHANGED
@@ -45,14 +45,26 @@ with style_image:
45
  StyleColumnTitle, StyleImageSelectionPrompt, "Style", "style"
46
  )
47
 
48
- # STYLIZE CONTENT IMAGE
49
- stylize_image = st.button("πŸ–ΌοΈπŸ–ŒοΈπŸŽ¨ Start Neural Style Transfer πŸ–ΌοΈπŸ–ŒοΈπŸŽ¨")
50
-
51
- if stylize_image:
52
- final_image = stylize_content_image(model, content_image_file, style_image_file)
53
- st.write("# Styled Image:")
54
- st.image(final_image)
55
- try:
56
- remove_source_images()
57
- except:
58
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
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.")