Spaces:
Running
Running
File size: 1,062 Bytes
91f3c16 c84f2c4 91f3c16 c84f2c4 91f3c16 c84f2c4 91f3c16 c84f2c4 91f3c16 c84f2c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
import librosa
from scripts.predict import predict_multimodal, predict_unimodal
def predict_multimodal_runner(sample: str):
# Load test audio and lyrics
audio_path = f"data/external/{sample}.mp3"
lyrics_path = f"data/external/{sample}.txt"
# Load audio
audio_data, sr = librosa.load(audio_path)
# Load lyrics
with open(lyrics_path, "r", encoding="utf-8") as f:
lyrics_text = f.read()
print("Running prediction pipeline...")
prediction = predict_multimodal(audio_data, lyrics_text)
print(f"\n=== PREDICTION RESULT ===")
print(f"Prediction: {prediction}")
def predict_unimodal_runner(sample: str):
# Load test audio and lyrics
audio_path = f"data/raw/{sample}.mp3"
# Load audio
audio_data, sr = librosa.load(audio_path)
print("Running prediction pipeline...")
prediction = predict_unimodal(audio_data)
print(f"\n=== PREDICTION RESULT ===")
print(f"Prediction: {prediction}")
if __name__ == "__main__":
sample = "fake_sunshine"
predict_unimodal_runner(sample) |