Spaces:
Runtime error
Runtime error
TheStinger
commited on
Commit
•
67c538c
1
Parent(s):
457965a
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import matplotlib.pyplot as plt
|
|
|
3 |
import numpy as np
|
4 |
import os
|
5 |
import soundfile as sf
|
@@ -46,6 +47,19 @@ def main():
|
|
46 |
|
47 |
def create_spectrogram_and_get_info(audio_file):
|
48 |
plt.clf()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
plt.figure(figsize=(15, 5))
|
50 |
audio_data, sample_rate = sf.read(audio_file)
|
51 |
if len(audio_data.shape) > 1:
|
|
|
1 |
import gradio as gr
|
2 |
import matplotlib.pyplot as plt
|
3 |
+
from matplotlib.colors import LinearSegmentedColormap
|
4 |
import numpy as np
|
5 |
import os
|
6 |
import soundfile as sf
|
|
|
47 |
|
48 |
def create_spectrogram_and_get_info(audio_file):
|
49 |
plt.clf()
|
50 |
+
|
51 |
+
cdict = {'red': [(0.0, 0.5, 0.5),
|
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.5, 0.5),
|
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:
|