Spaces:
Sleeping
Sleeping
Commit
·
cd65a38
1
Parent(s):
95f3812
remove gr.JSON
Browse files
app.py
CHANGED
|
@@ -71,13 +71,24 @@ def generate_dummy_metadata(stem_choice: str, username: str) -> Dict:
|
|
| 71 |
"labels": [vars(label) for label in label_list.labels]
|
| 72 |
}
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
|
|
|
|
|
|
| 81 |
|
| 82 |
|
| 83 |
|
|
|
|
| 71 |
"labels": [vars(label) for label in label_list.labels]
|
| 72 |
}
|
| 73 |
|
| 74 |
+
import json
|
| 75 |
+
|
| 76 |
+
def process_fn_stem(audio_file_path, demucs_model, stem_choice, profile=None):
|
| 77 |
+
username = profile.username if profile else "anonymous"
|
| 78 |
+
|
| 79 |
+
stem_signal = separate_stem(audio_file_path, model_name=demucs_model, stem_choice=stem_choice)
|
| 80 |
+
stem_filename = f"{stem_choice.lower().replace(' ', '_')}.wav"
|
| 81 |
+
stem_path = save_audio(stem_signal, stem_filename)
|
| 82 |
+
|
| 83 |
+
metadata = {
|
| 84 |
+
"user": username,
|
| 85 |
+
"stem": stem_choice,
|
| 86 |
+
"amplitude": 0.7,
|
| 87 |
+
"description": f"Start of {stem_choice}"
|
| 88 |
}
|
| 89 |
|
| 90 |
+
return stem_path, json.dumps(metadata, indent=2)
|
| 91 |
+
|
| 92 |
|
| 93 |
|
| 94 |
|