awacke1 commited on
Commit
194c9bb
1 Parent(s): 54c106b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -21
app.py CHANGED
@@ -129,9 +129,9 @@ with st.expander("Help / About 📚", expanded=False):
129
  - 🔍 **Query Use:** Use URL query like `?q=Heart` for specific insights.
130
  ''')
131
 
132
- # -----------------------------------------------------------------Art Card Sidebar:
133
- import base64
134
- import requests
135
  def get_image_as_base64(url):
136
  response = requests.get(url)
137
  if response.status_code == 200:
@@ -139,31 +139,25 @@ def get_image_as_base64(url):
139
  return base64.b64encode(response.content).decode("utf-8")
140
  else:
141
  return None
142
-
143
  def create_download_link(filename, base64_str):
144
  href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
145
  return href
146
-
147
- # Get this from paste into markdown feature
148
- #image_url = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/BGZtL7XUBqRI-PapdyZxs.png"
149
- image_url = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/YZGOLf6fE1spAdyorCNGh.png"
150
- image_url2 = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/qERawJvVM9P3s13tn5uHf.png"
151
- image_url3 = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/DBOu6KKrd-f9TEqmFYS2t.png"
152
- image_base64 = get_image_as_base64(image_url)
153
- image_base642 = get_image_as_base64(image_url2)
154
- image_base643 = get_image_as_base64(image_url3)
155
- if image_base64 is not None:
156
  with st.sidebar:
157
- st.markdown("""### Body Map Condition AI""")
158
- st.markdown(f"![image](data:image/png;base64,{image_base64})")
159
- st.markdown(f"![image](data:image/png;base64,{image_base642})")
160
- st.markdown(f"![image](data:image/png;base64,{image_base643})")
161
- #download_link = create_download_link("downloaded_image.png", image_base64)
162
- #st.markdown(download_link, unsafe_allow_html=True)
163
  else:
164
  st.sidebar.write("Failed to load the image.")
165
- # ------------------------------------------------------------- Art Card Sidebar
166
 
 
167
 
168
  st.markdown('''### BodyMap Condition AI 🃏🚀📚''')
169
 
 
129
  - 🔍 **Query Use:** Use URL query like `?q=Heart` for specific insights.
130
  ''')
131
 
132
+
133
+
134
+ # ---- Art Card Sidebar with Random Selection of image:
135
  def get_image_as_base64(url):
136
  response = requests.get(url)
137
  if response.status_code == 200:
 
139
  return base64.b64encode(response.content).decode("utf-8")
140
  else:
141
  return None
 
142
  def create_download_link(filename, base64_str):
143
  href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
144
  return href
145
+ image_urls = [
146
+ "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/YZGOLf6fE1spAdyorCNGh.png",
147
+ "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/qERawJvVM9P3s13tn5uHf.png",
148
+ "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/DBOu6KKrd-f9TEqmFYS2t.png",
149
+ ]
150
+ selected_image_url = random.choice(image_urls)
151
+ selected_image_base64 = get_image_as_base64(selected_image_url)
152
+ if selected_image_base64 is not None:
 
 
153
  with st.sidebar:
154
+ st.markdown("""### Word Game AI""")
155
+ st.markdown(f"![image](data:image/png;base64,{selected_image_base64})")
 
 
 
 
156
  else:
157
  st.sidebar.write("Failed to load the image.")
158
+ # ---- Art Card Sidebar with random selection of image.
159
 
160
+
161
 
162
  st.markdown('''### BodyMap Condition AI 🃏🚀📚''')
163