Spaces:
Runtime error
Runtime error
File size: 1,285 Bytes
2ab45c8 |
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 34 35 36 37 38 39 40 |
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.')
|