hagenw commited on
Commit
7454896
·
1 Parent(s): f62c750

Handle different model output sizes

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -136,7 +136,12 @@ def process_func(x: np.ndarray, sampling_rate: int) -> dict:
136
  # run through model
137
  with torch.no_grad():
138
  y = model(y)
139
- y = torch.hstack([y[1], y[2]])
 
 
 
 
 
140
 
141
  # convert to numpy
142
  y = y.detach().cpu().numpy()
 
136
  # run through model
137
  with torch.no_grad():
138
  y = model(y)
139
+ if len(y) == 2:
140
+ # Age-gender model
141
+ y = torch.hstack([y[1], y[2]])
142
+ else:
143
+ # Expression model
144
+ y = y[1]
145
 
146
  # convert to numpy
147
  y = y.detach().cpu().numpy()