awacke1 commited on
Commit
c6ef36b
·
verified ·
1 Parent(s): 5f1254f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -17,12 +17,9 @@ st.set_page_config(
17
  }
18
  )
19
 
20
-
21
-
22
  import base64
23
  import requests
24
-
25
- # Function to fetch and encode the image to base64
26
  def get_image_as_base64(url):
27
  response = requests.get(url)
28
  if response.status_code == 200:
@@ -30,26 +27,27 @@ def get_image_as_base64(url):
30
  return base64.b64encode(response.content).decode("utf-8")
31
  else:
32
  return None
33
-
34
- # Function to create a download link for the image
35
  def create_download_link(filename, base64_str):
36
  href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
37
  return href
38
 
39
- # URL of the image you want to display and download
40
- image_url = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/pxbIhDGTbdgv22giGuI-i.png"
41
- image_base64 = get_image_as_base64(image_url)
 
42
 
 
43
  if image_base64 is not None:
44
- # Display the image using the base64 string
45
  with st.sidebar:
 
46
  st.markdown(f"![image](data:image/png;base64,{image_base64})")
47
-
48
- # Provide a download link for the image
49
  download_link = create_download_link("downloaded_image.png", image_base64)
50
  st.markdown(download_link, unsafe_allow_html=True)
51
  else:
52
  st.sidebar.write("Failed to load the image.")
 
 
53
 
54
 
55
  with st.sidebar:
 
17
  }
18
  )
19
 
20
+ # -----------------------------------------------------------------Art Card Sidebar:
 
21
  import base64
22
  import requests
 
 
23
  def get_image_as_base64(url):
24
  response = requests.get(url)
25
  if response.status_code == 200:
 
27
  return base64.b64encode(response.content).decode("utf-8")
28
  else:
29
  return None
30
+
 
31
  def create_download_link(filename, base64_str):
32
  href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
33
  return href
34
 
35
+ # Get this from paste into markdown feature
36
+ #image_url = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/pxbIhDGTbdgv22giGuI-i.png"
37
+
38
+ image_url = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/o1FI3G_BueAAanLBeqoo3.png"
39
 
40
+ image_base64 = get_image_as_base64(image_url)
41
  if image_base64 is not None:
 
42
  with st.sidebar:
43
+ st.markdown("""### Mixable Card Game AI""")
44
  st.markdown(f"![image](data:image/png;base64,{image_base64})")
 
 
45
  download_link = create_download_link("downloaded_image.png", image_base64)
46
  st.markdown(download_link, unsafe_allow_html=True)
47
  else:
48
  st.sidebar.write("Failed to load the image.")
49
+ # ------------------------------------------------------------- Art Card Sidebar
50
+
51
 
52
 
53
  with st.sidebar: