Spaces:
Runtime error
Runtime error
TheStinger
commited on
Commit
•
9a8d907
1
Parent(s):
9f83153
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def main():
|
|
29 |
|
30 |
app.queue(max_size=1022).launch(share=True)
|
31 |
|
32 |
-
def create_spectrogram_and_get_info(audio_file
|
33 |
# Clear figure in case it has data in it
|
34 |
plt.clf()
|
35 |
|
@@ -42,7 +42,7 @@ def create_spectrogram_and_get_info(audio_file, output_markdown):
|
|
42 |
|
43 |
# Create the spectrogram
|
44 |
plt.specgram(audio_data, Fs=sample_rate / 1, NFFT=4096, sides='onesided',
|
45 |
-
cmap="Reds_r", scale_by_freq=True, scale='dB', mode='magnitude'
|
46 |
|
47 |
# Save the spectrogram to a PNG file
|
48 |
plt.savefig('spectrogram.png')
|
@@ -79,15 +79,8 @@ def create_spectrogram_and_get_info(audio_file, output_markdown):
|
|
79 |
</center>
|
80 |
"""
|
81 |
|
82 |
-
# Delete the audio file after analyzing it
|
83 |
-
os.remove(audio_file)
|
84 |
-
|
85 |
-
# Clear the markdown content
|
86 |
-
output_markdown.update({"value": "", "__type__": "update"})
|
87 |
-
|
88 |
# Return the PNG file of the spectrogram and the info table
|
89 |
return info_table, 'spectrogram.png'
|
90 |
|
91 |
-
|
92 |
# Create the Gradio interface
|
93 |
-
main()
|
|
|
29 |
|
30 |
app.queue(max_size=1022).launch(share=True)
|
31 |
|
32 |
+
def create_spectrogram_and_get_info(audio_file):
|
33 |
# Clear figure in case it has data in it
|
34 |
plt.clf()
|
35 |
|
|
|
42 |
|
43 |
# Create the spectrogram
|
44 |
plt.specgram(audio_data, Fs=sample_rate / 1, NFFT=4096, sides='onesided',
|
45 |
+
cmap="Reds_r", scale_by_freq=True, scale='dB', mode='magnitude')
|
46 |
|
47 |
# Save the spectrogram to a PNG file
|
48 |
plt.savefig('spectrogram.png')
|
|
|
79 |
</center>
|
80 |
"""
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
# Return the PNG file of the spectrogram and the info table
|
83 |
return info_table, 'spectrogram.png'
|
84 |
|
|
|
85 |
# Create the Gradio interface
|
86 |
+
main()
|