bisoye's picture
Create app.py
fcd5d71 verified
raw
history blame
No virus
2.15 kB
import gradio as gr
from main import main
with gr.Blocks() 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')
with gr.Column():
input_image = gr.Image(type='numpy',
image_mode='RGB',
sources='webcam',
interactive=True,
height=640,
width=640,
label='Webcam Image')
cropped_input_image = gr.Image(type='pil',
image_mode='RGB',
interactive=False,
height=640,
width=640,
label='Detected face in webcam image')
with gr.Column(scale=1):
returned_image = gr.Image(type='pil',
image_mode='RGB',
interactive=False,
height=640,
width=640,
label='Image in database')
cropped_returned_image = gr.Image(type='pil',
image_mode='RGB',
interactive=False,
height=640,
width=640,
label='Face in image in database')
submit_button = gr.Button(value='Submit')
result = gr.Textbox(label='Result',
interactive=False)
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)