Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,24 @@ client = chromadb.PersistentClient(path=path)
|
|
| 14 |
import streamlit as st
|
| 15 |
from PIL import Image as PILImage
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def display_images(image_collection, query_text, max_distance=None, debug=False):
|
| 18 |
"""
|
| 19 |
Display images in a Streamlit app based on a query.
|
|
|
|
| 14 |
import streamlit as st
|
| 15 |
from PIL import Image as PILImage
|
| 16 |
|
| 17 |
+
def add_background_image(image_path):
|
| 18 |
+
with open(image_path, "rb") as image_file:
|
| 19 |
+
base64_image = base64.b64encode(image_file.read()).decode()
|
| 20 |
+
css = f"""
|
| 21 |
+
<style>
|
| 22 |
+
.stApp {{
|
| 23 |
+
background-image: url("data:image/png;base64,{base64_image}");
|
| 24 |
+
background-size: cover;
|
| 25 |
+
background-repeat: no-repeat;
|
| 26 |
+
background-attachment: fixed;
|
| 27 |
+
}}
|
| 28 |
+
</style>
|
| 29 |
+
"""
|
| 30 |
+
st.markdown(css, unsafe_allow_html=True)
|
| 31 |
+
|
| 32 |
+
# Call the function with your image path
|
| 33 |
+
add_background_image("bg.png")
|
| 34 |
+
|
| 35 |
def display_images(image_collection, query_text, max_distance=None, debug=False):
|
| 36 |
"""
|
| 37 |
Display images in a Streamlit app based on a query.
|