Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,33 @@ st.set_page_config(
|
|
| 16 |
'About': "# Midjourney: https://discord.com/channels/@me/997514686608191558"
|
| 17 |
}
|
| 18 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Ensure the directory for storing scores exists
|
| 21 |
score_dir = "scores"
|
|
|
|
| 16 |
'About': "# Midjourney: https://discord.com/channels/@me/997514686608191558"
|
| 17 |
}
|
| 18 |
)
|
| 19 |
+
# -----------------------------------------------------------------Art Card Sidebar:
|
| 20 |
+
import base64
|
| 21 |
+
import requests
|
| 22 |
+
def get_image_as_base64(url):
|
| 23 |
+
response = requests.get(url)
|
| 24 |
+
if response.status_code == 200:
|
| 25 |
+
# Convert the image to base64
|
| 26 |
+
return base64.b64encode(response.content).decode("utf-8")
|
| 27 |
+
else:
|
| 28 |
+
return None
|
| 29 |
+
|
| 30 |
+
def create_download_link(filename, base64_str):
|
| 31 |
+
href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
|
| 32 |
+
return href
|
| 33 |
+
|
| 34 |
+
# Get this from paste into markdown feature
|
| 35 |
+
image_url = "https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/2kZD552wvmni_aLjls1Yp.png"
|
| 36 |
+
image_base64 = get_image_as_base64(image_url)
|
| 37 |
+
if image_base64 is not None:
|
| 38 |
+
with st.sidebar:
|
| 39 |
+
st.markdown("""### Body Map Condition AI""")
|
| 40 |
+
st.markdown(f"")
|
| 41 |
+
#download_link = create_download_link("downloaded_image.png", image_base64)
|
| 42 |
+
#st.markdown(download_link, unsafe_allow_html=True)
|
| 43 |
+
else:
|
| 44 |
+
st.sidebar.write("Failed to load the image.")
|
| 45 |
+
# ------------------------------------------------------------- Art Card Sidebar
|
| 46 |
|
| 47 |
# Ensure the directory for storing scores exists
|
| 48 |
score_dir = "scores"
|