Spaces:
Sleeping
Sleeping
Revert "add per template"
Browse filesThis reverts commit 9011b0e2faf24502f5bab8b920f57fea7a439357.
- evaluation/svs_eval.py +3 -3
- interface.py +2 -4
evaluation/svs_eval.py
CHANGED
|
@@ -72,7 +72,7 @@ def compute_dissonance_rate(intervals, dissonant_intervals={1, 2, 6, 10, 11}):
|
|
| 72 |
return np.mean(dissonant) if intervals else np.nan
|
| 73 |
|
| 74 |
|
| 75 |
-
def eval_per(audio_path,
|
| 76 |
audio_array, sr = librosa.load(audio_path, sr=16000)
|
| 77 |
# TODO: implement PER evaluation
|
| 78 |
return {}
|
|
@@ -99,12 +99,12 @@ def load_evaluators(config):
|
|
| 99 |
return loaded
|
| 100 |
|
| 101 |
|
| 102 |
-
def run_evaluation(audio_path, evaluators
|
| 103 |
results = {}
|
| 104 |
if "singmos" in evaluators:
|
| 105 |
results.update(eval_singmos(audio_path, evaluators["singmos"]))
|
| 106 |
if "per" in evaluators:
|
| 107 |
-
results.update(eval_per(audio_path,
|
| 108 |
if "melody" in evaluators:
|
| 109 |
results.update(eval_melody_metrics(audio_path, evaluators["melody"]))
|
| 110 |
if "aesthetic" in evaluators:
|
|
|
|
| 72 |
return np.mean(dissonant) if intervals else np.nan
|
| 73 |
|
| 74 |
|
| 75 |
+
def eval_per(audio_path, model=None):
|
| 76 |
audio_array, sr = librosa.load(audio_path, sr=16000)
|
| 77 |
# TODO: implement PER evaluation
|
| 78 |
return {}
|
|
|
|
| 99 |
return loaded
|
| 100 |
|
| 101 |
|
| 102 |
+
def run_evaluation(audio_path, evaluators):
|
| 103 |
results = {}
|
| 104 |
if "singmos" in evaluators:
|
| 105 |
results.update(eval_singmos(audio_path, evaluators["singmos"]))
|
| 106 |
if "per" in evaluators:
|
| 107 |
+
results.update(eval_per(audio_path, evaluators["per"]))
|
| 108 |
if "melody" in evaluators:
|
| 109 |
results.update(eval_melody_metrics(audio_path, evaluators["melody"]))
|
| 110 |
if "aesthetic" in evaluators:
|
interface.py
CHANGED
|
@@ -24,7 +24,6 @@ class GradioInterface:
|
|
| 24 |
self.character_info[self.current_character].default_voice
|
| 25 |
]
|
| 26 |
self.pipeline = SingingDialoguePipeline(self.default_config)
|
| 27 |
-
self.results = None
|
| 28 |
|
| 29 |
def load_config(self, path: str):
|
| 30 |
with open(path, "r") as f:
|
|
@@ -219,15 +218,14 @@ class GradioInterface:
|
|
| 219 |
self.current_voice,
|
| 220 |
output_audio_path=tmp_file,
|
| 221 |
)
|
| 222 |
-
self.results = results
|
| 223 |
formatted_logs = f"ASR: {results['asr_text']}\nLLM: {results['llm_text']}"
|
| 224 |
return gr.update(value=formatted_logs), gr.update(
|
| 225 |
value=results["output_audio_path"]
|
| 226 |
)
|
| 227 |
|
| 228 |
def update_metrics(self, audio_path):
|
| 229 |
-
if not audio_path
|
| 230 |
return gr.update(value="")
|
| 231 |
-
results = self.pipeline.evaluate(audio_path
|
| 232 |
formatted_metrics = "\n".join([f"{k}: {v}" for k, v in results.items()])
|
| 233 |
return gr.update(value=formatted_metrics)
|
|
|
|
| 24 |
self.character_info[self.current_character].default_voice
|
| 25 |
]
|
| 26 |
self.pipeline = SingingDialoguePipeline(self.default_config)
|
|
|
|
| 27 |
|
| 28 |
def load_config(self, path: str):
|
| 29 |
with open(path, "r") as f:
|
|
|
|
| 218 |
self.current_voice,
|
| 219 |
output_audio_path=tmp_file,
|
| 220 |
)
|
|
|
|
| 221 |
formatted_logs = f"ASR: {results['asr_text']}\nLLM: {results['llm_text']}"
|
| 222 |
return gr.update(value=formatted_logs), gr.update(
|
| 223 |
value=results["output_audio_path"]
|
| 224 |
)
|
| 225 |
|
| 226 |
def update_metrics(self, audio_path):
|
| 227 |
+
if not audio_path:
|
| 228 |
return gr.update(value="")
|
| 229 |
+
results = self.pipeline.evaluate(audio_path)
|
| 230 |
formatted_metrics = "\n".join([f"{k}: {v}" for k, v in results.items()])
|
| 231 |
return gr.update(value=formatted_metrics)
|