Update app.py
Browse files
app.py
CHANGED
|
@@ -45,15 +45,14 @@ def display_images(image_collection, query_text, max_distance=None, debug=False)
|
|
| 45 |
st.write(f"URI: {uri} - Distance: {distance}")
|
| 46 |
try:
|
| 47 |
img = PILImage.open(uri)
|
|
|
|
| 48 |
st.image(img, width=300)
|
| 49 |
except Exception as e:
|
| 50 |
st.error(f"Error loading image {uri}: {e}")
|
| 51 |
else:
|
| 52 |
if debug:
|
| 53 |
st.write(f"URI: {uri} - Distance: {distance} (Filtered out)")
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 57 |
def display_videos_streamlit(video_collection, query_text, max_distance=None, max_results=5, debug=False):
|
| 58 |
"""
|
| 59 |
Display videos in a Streamlit app based on a query.
|
|
@@ -260,6 +259,7 @@ def page_1():
|
|
| 260 |
progress_bar.progress(0)
|
| 261 |
status_text.text("")
|
| 262 |
st.error(f"Error processing files: {e}")
|
|
|
|
| 263 |
|
| 264 |
def page_2():
|
| 265 |
st.title("Page 2: Query and Use Processed Collections")
|
|
|
|
| 45 |
st.write(f"URI: {uri} - Distance: {distance}")
|
| 46 |
try:
|
| 47 |
img = PILImage.open(uri)
|
| 48 |
+
img = img.resize((img.width // 2, img.height // 2)) # Resize image for better performance
|
| 49 |
st.image(img, width=300)
|
| 50 |
except Exception as e:
|
| 51 |
st.error(f"Error loading image {uri}: {e}")
|
| 52 |
else:
|
| 53 |
if debug:
|
| 54 |
st.write(f"URI: {uri} - Distance: {distance} (Filtered out)")
|
|
|
|
| 55 |
|
|
|
|
| 56 |
def display_videos_streamlit(video_collection, query_text, max_distance=None, max_results=5, debug=False):
|
| 57 |
"""
|
| 58 |
Display videos in a Streamlit app based on a query.
|
|
|
|
| 259 |
progress_bar.progress(0)
|
| 260 |
status_text.text("")
|
| 261 |
st.error(f"Error processing files: {e}")
|
| 262 |
+
st.write(f"Error details: {e}")
|
| 263 |
|
| 264 |
def page_2():
|
| 265 |
st.title("Page 2: Query and Use Processed Collections")
|