image-search-playground / streamlit_app.py
jasonwuyl92
initial commit after cleanup
2ab45c8
import streamlit as st
import numpy as np
from PIL import Image
def process_image(input_image):
# Your image processing function goes here
output_image = input_image.copy()
return output_image
# Set the title of the web application
st.title('Multiple Input and Output Images Interface')
# Create a sidebar for image inputs
st.sidebar.title('Input Images')
# Set up a file uploader in the sidebar for each input image
uploaded_images = []
num_images = 3 # The number of input images
for i in range(num_images):
uploaded_image = st.sidebar.file_uploader(f'Upload Image {i+1}', type=['png', 'jpg', 'jpeg'])
if uploaded_image is not None:
uploaded_images.append(uploaded_image)
# Display input images and process them
if uploaded_images:
st.header('Input Images')
input_images = []
for img in uploaded_images:
input_img = Image.open(img)
input_images.append(input_img)
st.image(input_img, width=200, caption='Uploaded Image')
# Process input images and display output images
st.header('Output Images')
for input_img in input_images:
output_img = process_image(input_img)
st.image(output_img, width=200, caption='Processed Image')
else:
st.warning('Please upload images in the sidebar.')