Spaces:
Running
Running
Fix error
Browse files
app.py
CHANGED
|
@@ -136,8 +136,7 @@ def process_func(x: np.ndarray, sampling_rate: int) -> dict:
|
|
| 136 |
# run through model
|
| 137 |
with torch.no_grad():
|
| 138 |
y = model(y)
|
| 139 |
-
|
| 140 |
-
if len(y) == 2:
|
| 141 |
# Age-gender model
|
| 142 |
y = torch.hstack([y[1], y[2]])
|
| 143 |
else:
|
|
@@ -184,13 +183,13 @@ def recognize(input_file):
|
|
| 184 |
|
| 185 |
description = (
|
| 186 |
"Recognize "
|
| 187 |
-
f"[age
|
|
|
|
| 188 |
f"and [expression](https://huggingface.co/{expression_model_name}) "
|
| 189 |
"of an audio file or microphone recording."
|
| 190 |
)
|
| 191 |
|
| 192 |
with gr.Blocks() as demo:
|
| 193 |
-
gr.Markdown(description)
|
| 194 |
with gr.Tab(label="Speech analysis"):
|
| 195 |
with gr.Row():
|
| 196 |
with gr.Column():
|
|
|
|
| 136 |
# run through model
|
| 137 |
with torch.no_grad():
|
| 138 |
y = model(y)
|
| 139 |
+
if len(y) == 3:
|
|
|
|
| 140 |
# Age-gender model
|
| 141 |
y = torch.hstack([y[1], y[2]])
|
| 142 |
else:
|
|
|
|
| 183 |
|
| 184 |
description = (
|
| 185 |
"Recognize "
|
| 186 |
+
f"[age](https://huggingface.co/{age_gender_model_name}), "
|
| 187 |
+
f"[gender](https://huggingface.co/{age_gender_model_name}), "
|
| 188 |
f"and [expression](https://huggingface.co/{expression_model_name}) "
|
| 189 |
"of an audio file or microphone recording."
|
| 190 |
)
|
| 191 |
|
| 192 |
with gr.Blocks() as demo:
|
|
|
|
| 193 |
with gr.Tab(label="Speech analysis"):
|
| 194 |
with gr.Row():
|
| 195 |
with gr.Column():
|