Spaces:
Runtime error
Runtime error
fix: clear image cache
Browse files- specify only for URL images
- app.py +8 -8
- 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 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
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
|