one / app.py
dp92's picture
Update app.py
922c634
raw
history blame
955 Bytes
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)