VanShingel commited on
Commit
154397e
1 Parent(s): 0f58034

beta beautify

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -81,14 +81,15 @@ def main_pipeline(image):
81
  gender = 'female'
82
 
83
  data = {}
84
- data['age'] = str(age_prds[0][0])
85
  data['gender'] = gender
86
 
87
  image_b_box = cv2.rectangle(np.asarray(original_image), (x, y), (x+w, y+h), (255, 0, 0), 2)
88
 
89
  result_image = Image.fromarray(image_b_box)
90
  result_image = result_image.resize((150,150))
91
- return result_image, data['age'], data['gender']
 
92
 
93
  # initializing the input component
94
  image = gr.inputs.Image(shape = (224, 224))
@@ -97,7 +98,7 @@ labels = gr.outputs.Label()
97
 
98
 
99
  # launching the interface
100
- gr.Interface(fn = main_pipeline, inputs = image,
101
- outputs = ['image',
102
- 'text',
103
- 'text'], capture_session = True).launch()
 
81
  gender = 'female'
82
 
83
  data = {}
84
+ data['age'] = int(age_prds[0][0])
85
  data['gender'] = gender
86
 
87
  image_b_box = cv2.rectangle(np.asarray(original_image), (x, y), (x+w, y+h), (255, 0, 0), 2)
88
 
89
  result_image = Image.fromarray(image_b_box)
90
  result_image = result_image.resize((150,150))
91
+
92
+ return result_image, f"~ {(data['age'])}", data['gender']
93
 
94
  # initializing the input component
95
  image = gr.inputs.Image(shape = (224, 224))
 
98
 
99
 
100
  # launching the interface
101
+ gr.Interface(fn = main_pipeline, title= 'Age & Gender predictions', inputs = image,
102
+ outputs = [gr.Image(label= 'Result'),
103
+ gr.Text(label= 'Age'),
104
+ gr.Text(label= 'Gender')], flagging_options=["correct", "incorrect", "other"], capture_session = True).launch()