bisoye commited on
Commit
fcd5d71
1 Parent(s): 8a0985b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -0
app.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from main import main
3
+
4
+
5
+ with gr.Blocks() as demo:
6
+
7
+ with gr.Row():
8
+ with gr.Column():
9
+ last_name = gr.Textbox(label='last name',
10
+ interactive=True,
11
+ value='ABOLADE')
12
+ matric_no = gr.Textbox(label='Matric number',
13
+ interactive=True,
14
+ value='CPE/18/6627')
15
+
16
+ with gr.Column():
17
+ input_image = gr.Image(type='numpy',
18
+ image_mode='RGB',
19
+ sources='webcam',
20
+ interactive=True,
21
+ height=640,
22
+ width=640,
23
+ label='Webcam Image')
24
+
25
+ cropped_input_image = gr.Image(type='pil',
26
+ image_mode='RGB',
27
+ interactive=False,
28
+ height=640,
29
+ width=640,
30
+ label='Detected face in webcam image')
31
+
32
+ with gr.Column(scale=1):
33
+ returned_image = gr.Image(type='pil',
34
+ image_mode='RGB',
35
+ interactive=False,
36
+ height=640,
37
+ width=640,
38
+ label='Image in database')
39
+ cropped_returned_image = gr.Image(type='pil',
40
+ image_mode='RGB',
41
+ interactive=False,
42
+ height=640,
43
+ width=640,
44
+ label='Face in image in database')
45
+
46
+ submit_button = gr.Button(value='Submit')
47
+ result = gr.Textbox(label='Result',
48
+ interactive=False)
49
+ submit_button.click(fn = main,
50
+ inputs=[last_name, matric_no, input_image],
51
+ outputs=[result, cropped_input_image,
52
+ cropped_returned_image, returned_image,
53
+ ]
54
+ )
55
+
56
+
57
+ if __name__ == '__main__':
58
+ demo.launch(share=False)
59
+
60
+