root
commited on
Commit
·
2c4561e
1
Parent(s):
547c4d0
Initial commit
Browse files- emotionanalysis.py +11 -3
- requirements.txt +2 -1
emotionanalysis.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import librosa
|
2 |
import numpy as np
|
3 |
-
|
|
|
|
|
|
|
4 |
from scipy.stats import mode
|
5 |
import warnings
|
6 |
warnings.filterwarnings('ignore') # Suppress librosa warnings
|
@@ -372,14 +375,19 @@ class MusicAnalyzer:
|
|
372 |
|
373 |
# def visualize_analysis(self, file_path):
|
374 |
# """Create visualizations for the music analysis results"""
|
|
|
|
|
|
|
|
|
|
|
375 |
# # Load audio and run analysis
|
376 |
# y, sr = self.load_audio(file_path)
|
377 |
# if y is None:
|
378 |
# print("Error: Failed to load audio file")
|
379 |
# return
|
380 |
-
|
381 |
# results = self.analyze_music(file_path)
|
382 |
-
|
383 |
# # Create visualization
|
384 |
# plt.figure(figsize=(15, 12))
|
385 |
|
|
|
1 |
import librosa
|
2 |
import numpy as np
|
3 |
+
try:
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
except ImportError:
|
6 |
+
plt = None
|
7 |
from scipy.stats import mode
|
8 |
import warnings
|
9 |
warnings.filterwarnings('ignore') # Suppress librosa warnings
|
|
|
375 |
|
376 |
# def visualize_analysis(self, file_path):
|
377 |
# """Create visualizations for the music analysis results"""
|
378 |
+
# # Check if matplotlib is available
|
379 |
+
# if plt is None:
|
380 |
+
# print("Error: matplotlib is not installed. Visualization is not available.")
|
381 |
+
# return
|
382 |
+
#
|
383 |
# # Load audio and run analysis
|
384 |
# y, sr = self.load_audio(file_path)
|
385 |
# if y is None:
|
386 |
# print("Error: Failed to load audio file")
|
387 |
# return
|
388 |
+
#
|
389 |
# results = self.analyze_music(file_path)
|
390 |
+
#
|
391 |
# # Create visualization
|
392 |
# plt.figure(figsize=(15, 12))
|
393 |
|
requirements.txt
CHANGED
@@ -10,4 +10,5 @@ bitsandbytes>=0.41.1
|
|
10 |
sentencepiece>=0.1.99
|
11 |
safetensors>=0.4.1
|
12 |
scipy>=1.12.0
|
13 |
-
soundfile>=0.12.1
|
|
|
|
10 |
sentencepiece>=0.1.99
|
11 |
safetensors>=0.4.1
|
12 |
scipy>=1.12.0
|
13 |
+
soundfile>=0.12.1
|
14 |
+
matplotlib>=3.7.0
|