Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -112,9 +112,9 @@ def process_audio(audio_file):
|
|
112 |
# แสดงกราฟเสียงต้นฉบับ
|
113 |
fig, ax = plt.subplots(figsize=(10, 2))
|
114 |
ax.plot(waveform)
|
115 |
-
ax.set_title("
|
116 |
-
ax.set_xlabel("
|
117 |
-
ax.set_ylabel("
|
118 |
ax.grid(True, alpha=0.3)
|
119 |
st.pyplot(fig)
|
120 |
|
@@ -134,9 +134,9 @@ def process_audio(audio_file):
|
|
134 |
# แสดงกราฟเสียงที่มีเสียงรบกวน
|
135 |
fig, ax = plt.subplots(figsize=(10, 2))
|
136 |
ax.plot(noisy_waveform)
|
137 |
-
ax.set_title("
|
138 |
-
ax.set_xlabel("
|
139 |
-
ax.set_ylabel("
|
140 |
ax.grid(True, alpha=0.3)
|
141 |
st.pyplot(fig)
|
142 |
|
@@ -175,9 +175,9 @@ def process_audio(audio_file):
|
|
175 |
# แสดงกราฟเสียงที่แยกแล้ว
|
176 |
fig, ax = plt.subplots(figsize=(10, 2))
|
177 |
ax.plot(separated_waveform, color='green')
|
178 |
-
ax.set_title("
|
179 |
-
ax.set_xlabel("
|
180 |
-
ax.set_ylabel("
|
181 |
ax.grid(True, alpha=0.3)
|
182 |
st.pyplot(fig)
|
183 |
|
@@ -195,14 +195,14 @@ def process_audio(audio_file):
|
|
195 |
# แสดงกราฟเปรียบเทียบ
|
196 |
fig, ax = plt.subplots(2, 1, figsize=(10, 4), sharex=True)
|
197 |
ax[0].plot(noisy_waveform)
|
198 |
-
ax[0].set_title("
|
199 |
-
ax[0].set_ylabel("
|
200 |
ax[0].grid(True, alpha=0.3)
|
201 |
|
202 |
ax[1].plot(separated_waveform, color='green')
|
203 |
-
ax[1].set_title("
|
204 |
-
ax[1].set_xlabel("
|
205 |
-
ax[1].set_ylabel("
|
206 |
ax[1].grid(True, alpha=0.3)
|
207 |
|
208 |
plt.tight_layout()
|
@@ -215,14 +215,14 @@ def process_audio(audio_file):
|
|
215 |
|
216 |
# สเปกโตรแกรมของเสียงที่มีเสียงรบกวน
|
217 |
ax[0].specgram(noisy_waveform, Fs=sample_rate, NFFT=1024, noverlap=512, cmap='viridis')
|
218 |
-
ax[0].set_title("
|
219 |
-
ax[0].set_ylabel("
|
220 |
|
221 |
# สเปกโตรแกรมของเสียงที่แยกแล้ว
|
222 |
ax[1].specgram(separated_waveform, Fs=sample_rate, NFFT=1024, noverlap=512, cmap='viridis')
|
223 |
-
ax[1].set_title("
|
224 |
-
ax[1].set_xlabel("
|
225 |
-
ax[1].set_ylabel("
|
226 |
|
227 |
plt.tight_layout()
|
228 |
st.pyplot(fig)
|
|
|
112 |
# แสดงกราฟเสียงต้นฉบับ
|
113 |
fig, ax = plt.subplots(figsize=(10, 2))
|
114 |
ax.plot(waveform)
|
115 |
+
ax.set_title("Original Waveform")
|
116 |
+
ax.set_xlabel("Samples")
|
117 |
+
ax.set_ylabel("Amplitude")
|
118 |
ax.grid(True, alpha=0.3)
|
119 |
st.pyplot(fig)
|
120 |
|
|
|
134 |
# แสดงกราฟเสียงที่มีเสียงรบกวน
|
135 |
fig, ax = plt.subplots(figsize=(10, 2))
|
136 |
ax.plot(noisy_waveform)
|
137 |
+
ax.set_title("Noisy Waveform")
|
138 |
+
ax.set_xlabel("Samples")
|
139 |
+
ax.set_ylabel("Amplitude")
|
140 |
ax.grid(True, alpha=0.3)
|
141 |
st.pyplot(fig)
|
142 |
|
|
|
175 |
# แสดงกราฟเสียงที่แยกแล้ว
|
176 |
fig, ax = plt.subplots(figsize=(10, 2))
|
177 |
ax.plot(separated_waveform, color='green')
|
178 |
+
ax.set_title("Separated Waveform")
|
179 |
+
ax.set_xlabel("Samples")
|
180 |
+
ax.set_ylabel("Amplitude")
|
181 |
ax.grid(True, alpha=0.3)
|
182 |
st.pyplot(fig)
|
183 |
|
|
|
195 |
# แสดงกราฟเปรียบเทียบ
|
196 |
fig, ax = plt.subplots(2, 1, figsize=(10, 4), sharex=True)
|
197 |
ax[0].plot(noisy_waveform)
|
198 |
+
ax[0].set_title("Original/Noisy Waveform")
|
199 |
+
ax[0].set_ylabel("Amplitude")
|
200 |
ax[0].grid(True, alpha=0.3)
|
201 |
|
202 |
ax[1].plot(separated_waveform, color='green')
|
203 |
+
ax[1].set_title("Separated Waveform")
|
204 |
+
ax[1].set_xlabel("Samples")
|
205 |
+
ax[1].set_ylabel("Amplitude")
|
206 |
ax[1].grid(True, alpha=0.3)
|
207 |
|
208 |
plt.tight_layout()
|
|
|
215 |
|
216 |
# สเปกโตรแกรมของเสียงที่มีเสียงรบกวน
|
217 |
ax[0].specgram(noisy_waveform, Fs=sample_rate, NFFT=1024, noverlap=512, cmap='viridis')
|
218 |
+
ax[0].set_title("Spectrogram of Noisy Audio")
|
219 |
+
ax[0].set_ylabel("Frequency (Hz)")
|
220 |
|
221 |
# สเปกโตรแกรมของเสียงที่แยกแล้ว
|
222 |
ax[1].specgram(separated_waveform, Fs=sample_rate, NFFT=1024, noverlap=512, cmap='viridis')
|
223 |
+
ax[1].set_title("Spectrogram of Separated Audio")
|
224 |
+
ax[1].set_xlabel("Time (s)")
|
225 |
+
ax[1].set_ylabel("Frequency (Hz)")
|
226 |
|
227 |
plt.tight_layout()
|
228 |
st.pyplot(fig)
|