import gradio as gr from main import main with gr.Blocks(gr.themes.Soft()) as demo: with gr.Row(): with gr.Column(): last_name = gr.Textbox(label='last name', interactive=True, value='ABOLADE') matric_no = gr.Textbox(label='Matric number', interactive=True, value='CPE/18/6627') submit_button = gr.Button(value='Submit') result = gr.Textbox(label='Result', interactive=False) with gr.Column(): input_image = gr.Image(type='numpy', image_mode='RGB', sources='webcam', interactive=True, height=480, width=480, label='Webcam Image') cropped_input_image = gr.Image(type='pil', image_mode='RGB', interactive=False, height=480, width=480, label='Detected face in webcam image') with gr.Column(scale=1): returned_image = gr.Image(type='pil', image_mode='RGB', interactive=False, height=480, width=480, label='Image in database') cropped_returned_image = gr.Image(type='pil', image_mode='RGB', interactive=False, height=480, width=480, label='Face in image in database') submit_button.click(fn = main, inputs=[last_name, matric_no, input_image], outputs=[result, cropped_input_image, cropped_returned_image, returned_image, ] ) if __name__ == '__main__': demo.launch(share=False)