awacke1 commited on
Commit
b4b2bd3
·
verified ·
1 Parent(s): 7ecf2b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -43,6 +43,34 @@ st.set_page_config(
43
  'About': "Body Map AI By Aaron Wacker - https://huggingface.co/awacke1"
44
  }
45
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  if st.checkbox('Show Anatomy Table'):
48
  st.markdown("""
 
43
  'About': "Body Map AI By Aaron Wacker - https://huggingface.co/awacke1"
44
  }
45
  )
46
+ # -----------------------------------------------------------------Art Card Sidebar:
47
+ import base64
48
+ import requests
49
+ def get_image_as_base64(url):
50
+ response = requests.get(url)
51
+ if response.status_code == 200:
52
+ # Convert the image to base64
53
+ return base64.b64encode(response.content).decode("utf-8")
54
+ else:
55
+ return None
56
+
57
+ def create_download_link(filename, base64_str):
58
+ href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
59
+ return href
60
+
61
+ # Get this from paste into markdown feature
62
+ image_url = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/BGZtL7XUBqRI-PapdyZxs.png"
63
+
64
+ image_base64 = get_image_as_base64(image_url)
65
+ if image_base64 is not None:
66
+ with st.sidebar:
67
+ st.markdown("""### Mixable Card Game AI""")
68
+ st.markdown(f"![image](data:image/png;base64,{image_base64})")
69
+ download_link = create_download_link("downloaded_image.png", image_base64)
70
+ st.markdown(download_link, unsafe_allow_html=True)
71
+ else:
72
+ st.sidebar.write("Failed to load the image.")
73
+ # ------------------------------------------------------------- Art Card Sidebar
74
 
75
  if st.checkbox('Show Anatomy Table'):
76
  st.markdown("""