File size: 955 Bytes
2dbc820
 
 
 
 
 
 
 
 
 
922c634
2dbc820
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33



import streamlit as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cv2

# Load the test dataset
test_data = pd.read_csv("data.csv")

# Create a dropdown to select an image from the test dataset
selected_image = st.sidebar.selectbox("Select an image", test_data["image"])

# Create a file uploader to upload an image
uploaded_file = st.sidebar.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])

# Load the selected or uploaded image
if uploaded_file is not None:
    query_image = cv2.imread(uploaded_file.name)
else:
    query_image = cv2.imread(selected_image)

# Display the query image
st.image(query_image, caption="Query Image", use_column_width=True)

# Use the similarity search system to find the most similar images
similar_images = find_similar_images(query_image)

# Display the most similar images
for image in similar_images:
    st.image(image, caption="Similar Image", use_column_width=True)