Update app.py
Browse files
app.py
CHANGED
@@ -179,17 +179,25 @@ def main():
|
|
179 |
watermarked_audio = wav + watermark
|
180 |
print(watermarked_audio.size())
|
181 |
size = watermarked_audio.size()
|
182 |
-
st.markdown(size)
|
183 |
|
184 |
print(watermarked_audio.squeeze())
|
185 |
squeeze = watermarked_audio.squeeze(1)
|
186 |
shape = squeeze.size()
|
187 |
-
st.markdown(shape)
|
188 |
|
189 |
-
st.markdown(squeeze)
|
190 |
|
191 |
torchaudio.save("output.wav", squeeze, default_sr)
|
192 |
st.audio("output.wav", format="audio/wav")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
#2nd Attempt
|
195 |
# watermarked_audio = model(wav, sample_rate=default_sr, alpha=1)
|
@@ -213,10 +221,10 @@ def main():
|
|
213 |
#st.write("Time Cost: %d seconds" % encode_time_cost)
|
214 |
|
215 |
# # st.button("Add Watermark", disabled=False)
|
216 |
-
#
|
217 |
-
#
|
218 |
-
#
|
219 |
-
#
|
220 |
|
221 |
|
222 |
if __name__ == "__main__":
|
|
|
179 |
watermarked_audio = wav + watermark
|
180 |
print(watermarked_audio.size())
|
181 |
size = watermarked_audio.size()
|
182 |
+
#st.markdown(size)
|
183 |
|
184 |
print(watermarked_audio.squeeze())
|
185 |
squeeze = watermarked_audio.squeeze(1)
|
186 |
shape = squeeze.size()
|
187 |
+
#st.markdown(shape)
|
188 |
|
189 |
+
#st.markdown(squeeze)
|
190 |
|
191 |
torchaudio.save("output.wav", squeeze, default_sr)
|
192 |
st.audio("output.wav", format="audio/wav")
|
193 |
+
|
194 |
+
with open("output.wav", "wb") as file:
|
195 |
+
st.download_button(
|
196 |
+
label="Download Watermarked audio",
|
197 |
+
data=file,
|
198 |
+
file_name="output.wav",
|
199 |
+
mime="audio/wav",
|
200 |
+
)
|
201 |
|
202 |
#2nd Attempt
|
203 |
# watermarked_audio = model(wav, sample_rate=default_sr, alpha=1)
|
|
|
221 |
#st.write("Time Cost: %d seconds" % encode_time_cost)
|
222 |
|
223 |
# # st.button("Add Watermark", disabled=False)
|
224 |
+
# elif action == "Decode Watermark":
|
225 |
+
# if st.button("Decode"):
|
226 |
+
# with st.spinner("Decoding..."):
|
227 |
+
# decode_watermark(tmp_input_audio_file)
|
228 |
|
229 |
|
230 |
if __name__ == "__main__":
|