pkiage commited on
Commit
0740ae4
β€’
1 Parent(s): 5d9b5ae

fix: clear image cache

Browse files

- specify only for URL images

Files changed (2) hide show
  1. app.py +8 -8
  2. src/data/data.py +1 -1
app.py CHANGED
@@ -34,24 +34,24 @@ content_image, style_image = st.columns(2)
34
  with content_image:
35
  ContentColumnTitle = "## πŸ–ΌοΈ Content Image πŸ–ΌοΈ"
36
  ContentImageSelectionPrompt = "Pick a Content image"
37
- content_image_file = upload_image(
38
  ContentColumnTitle, ContentImageSelectionPrompt, "Content", "content"
39
  )
40
 
41
  with style_image:
42
  StyleColumnTitle = "## 🎨 Style Image 🎨"
43
  StyleImageSelectionPrompt = "Pick a Style image"
44
- style_image_file = upload_image(
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 πŸ–ΌοΈπŸ–ŒοΈπŸŽ¨")
 
34
  with content_image:
35
  ContentColumnTitle = "## πŸ–ΌοΈ Content Image πŸ–ΌοΈ"
36
  ContentImageSelectionPrompt = "Pick a Content image"
37
+ content_image_file, content_image_upload_method = upload_image(
38
  ContentColumnTitle, ContentImageSelectionPrompt, "Content", "content"
39
  )
40
 
41
  with style_image:
42
  StyleColumnTitle = "## 🎨 Style Image 🎨"
43
  StyleImageSelectionPrompt = "Pick a Style image"
44
+ style_image_file, style_image_upload_method = upload_image(
45
  StyleColumnTitle, StyleImageSelectionPrompt, "Style", "style"
46
  )
47
 
48
  if None not in (content_image_file, style_image_file):
49
+ if "πŸ”— URL" in (content_image_upload_method, style_image_upload_method):
50
+ # CLEAR IMAGES
51
+ clear_images = st.button(
52
+ label="πŸ”„βŒ Clear URL Image Cache βŒπŸ”„",
53
+ on_click=remove_source_images(),
54
+ )
55
 
56
  # STYLIZE CONTENT IMAGE
57
  stylize_image = st.button("πŸ–ΌοΈπŸ–ŒοΈπŸŽ¨ Start Neural Style Transfer πŸ–ΌοΈπŸ–ŒοΈπŸŽ¨")
src/data/data.py CHANGED
@@ -48,6 +48,6 @@ def upload_image(ColumnTitle, ImageSelectionPrompt, ImageType, KeyString):
48
  try:
49
  st.write(f"{ImageType} Image")
50
  st.image(imshow(image_file))
51
- return image_file
52
  except:
53
  pass
 
48
  try:
49
  st.write(f"{ImageType} Image")
50
  st.image(imshow(image_file))
51
+ return image_file, image_upload_method
52
  except:
53
  pass