How to change the camera input from column to row wise in streamlit

Viewed 57

I have an app which get the input as web image and convert into cartoonic image but it displays the camera input and output in column wise instead of that i need side by side(row wise)

Don't know whether we can reduce the width of the camera.input??

Any idea would be appreciated!

import cv2
import streamlit as st
import numpy as np 
from PIL import Image
import base64
from torch import square

def cartoonization (img):
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)            
    gray = cv2.medianBlur(gray, 7) 
    edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 7, 7)
    blurred = cv2.bilateralFilter(img, d=7, sigmaColor=200,sigmaSpace=200)
    cartoon = cv2.bitwise_and(blurred, blurred, mask=edges) 
    return cartoon

###############################################################################
    

file_image = st.camera_input(label = "Take a pic of you to be sketched out")

if file_image:
    input_img = Image.open(file_image)
    final_sketch = cartoonization(np.array(input_img))
    st.write("**Output Pencil Sketch**")
    one = st.columns(1)
    st.image(final_sketch, use_column_width=True)
    #with one:
        # st.write("**Input Photo**")
        #st.image(input_img, use_column_width=True)
    #with one:
        # st.write("**Output Pencil Sketch**")
        # st.image(final_sketch, use_column_width=True) 

else:
     st.write("You haven't uploaded any image file")
0 Answers
Related