lllindsey0615 commited on
Commit
cd65a38
·
1 Parent(s): 95f3812

remove gr.JSON

Browse files
Files changed (1) hide show
  1. app.py +16 -5
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
- def process_fn_stem(audio_file_path, demucs_model, stem_choice) -> dict:
75
- return {
76
- "hello": "world",
77
- "number": 123,
78
- "text" : "yes"
 
 
 
 
 
 
 
 
 
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