Spaces:
Runtime error
Runtime error
TheStinger
commited on
Commit
•
763202b
1
Parent(s):
501344c
Update app.py
Browse files
app.py
CHANGED
@@ -45,22 +45,25 @@ def main():
|
|
45 |
|
46 |
app.queue(max_size=1022).launch(share=True)
|
47 |
|
|
|
|
|
48 |
def create_spectrogram_and_get_info(audio_file):
|
49 |
plt.clf()
|
50 |
|
51 |
-
cdict = {'red': [(0.0, 0.
|
52 |
(0.5, 1.0, 1.0),
|
53 |
(1.0, 1.0, 1.0)],
|
54 |
'green': [(0.0, 0.0, 0.0),
|
55 |
(0.25, 0.0, 0.0),
|
56 |
(0.75, 1.0, 1.0),
|
57 |
(1.0, 1.0, 1.0)],
|
58 |
-
'blue': [(0.0, 0.
|
59 |
(0.5, 0.0, 0.0),
|
60 |
(1.0, 0.0, 0.0)]}
|
61 |
custom_cmap = LinearSegmentedColormap('CustomMap', cdict)
|
62 |
|
63 |
-
plt.figure(figsize=(15, 5))
|
|
|
64 |
audio_data, sample_rate = sf.read(audio_file)
|
65 |
if len(audio_data.shape) > 1:
|
66 |
audio_data = np.mean(audio_data, axis=1)
|
@@ -76,6 +79,7 @@ def create_spectrogram_and_get_info(audio_file):
|
|
76 |
speed_in_kbps = audio_info.samplerate * bit_depth / 1000
|
77 |
filename_without_extension, _ = os.path.splitext(os.path.basename(audio_file))
|
78 |
info_table = f"""
|
|
|
79 |
|
80 |
| Information | Value |
|
81 |
| :---: | :---: |
|
|
|
45 |
|
46 |
app.queue(max_size=1022).launch(share=True)
|
47 |
|
48 |
+
from matplotlib.colors import LinearSegmentedColormap
|
49 |
+
|
50 |
def create_spectrogram_and_get_info(audio_file):
|
51 |
plt.clf()
|
52 |
|
53 |
+
cdict = {'red': [(0.0, 0.0, 0.0),
|
54 |
(0.5, 1.0, 1.0),
|
55 |
(1.0, 1.0, 1.0)],
|
56 |
'green': [(0.0, 0.0, 0.0),
|
57 |
(0.25, 0.0, 0.0),
|
58 |
(0.75, 1.0, 1.0),
|
59 |
(1.0, 1.0, 1.0)],
|
60 |
+
'blue': [(0.0, 0.0, 0.0),
|
61 |
(0.5, 0.0, 0.0),
|
62 |
(1.0, 0.0, 0.0)]}
|
63 |
custom_cmap = LinearSegmentedColormap('CustomMap', cdict)
|
64 |
|
65 |
+
fig = plt.figure(figsize=(15, 5))
|
66 |
+
fig.patch.set_facecolor('black') # Imposta il colore di sfondo su nero
|
67 |
audio_data, sample_rate = sf.read(audio_file)
|
68 |
if len(audio_data.shape) > 1:
|
69 |
audio_data = np.mean(audio_data, axis=1)
|
|
|
79 |
speed_in_kbps = audio_info.samplerate * bit_depth / 1000
|
80 |
filename_without_extension, _ = os.path.splitext(os.path.basename(audio_file))
|
81 |
info_table = f"""
|
82 |
+
|
83 |
|
84 |
| Information | Value |
|
85 |
| :---: | :---: |
|