Update app.py
Browse files
app.py
CHANGED
@@ -152,23 +152,8 @@ def main():
|
|
152 |
#wav = my_read_file(wav,max_second_encode)
|
153 |
|
154 |
#1st attempt
|
155 |
-
|
156 |
-
|
157 |
-
# print(watermarked_audio.size())
|
158 |
-
# size = watermarked_audio.size()
|
159 |
-
# st.markdown(size)
|
160 |
-
|
161 |
-
# print(watermarked_audio.squeeze())
|
162 |
-
# squeeze = watermarked_audio.squeeze(1)
|
163 |
-
# shape = squeeze.size()
|
164 |
-
# st.markdown(shape)
|
165 |
-
|
166 |
-
# st.markdown(squeeze)
|
167 |
-
|
168 |
-
# watermarked_audio = torchaudio.save("output.wav", squeeze, default_sr)
|
169 |
-
|
170 |
-
#2nd Attempt
|
171 |
-
watermarked_audio = model(wav, sample_rate=default_sr, alpha=1)
|
172 |
print(watermarked_audio.size())
|
173 |
size = watermarked_audio.size()
|
174 |
st.markdown(size)
|
@@ -179,13 +164,29 @@ def main():
|
|
179 |
st.markdown(shape)
|
180 |
|
181 |
st.markdown(squeeze)
|
182 |
-
|
183 |
-
st.write("Watermarked Audio:")
|
184 |
-
st.markdown(watermarked_audio)
|
185 |
-
print("watermarked_audio:", watermarked_audio)
|
186 |
-
|
187 |
watermarked_audio = torchaudio.save("output.wav", squeeze, default_sr)
|
188 |
st.audio(watermarked_audio, format="audio/wav")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
#st.write("Time Cost: %d seconds" % encode_time_cost)
|
190 |
|
191 |
# # st.button("Add Watermark", disabled=False)
|
|
|
152 |
#wav = my_read_file(wav,max_second_encode)
|
153 |
|
154 |
#1st attempt
|
155 |
+
watermark = model.get_watermark(wav, default_sr)
|
156 |
+
watermarked_audio = wav + watermark
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
print(watermarked_audio.size())
|
158 |
size = watermarked_audio.size()
|
159 |
st.markdown(size)
|
|
|
164 |
st.markdown(shape)
|
165 |
|
166 |
st.markdown(squeeze)
|
167 |
+
|
|
|
|
|
|
|
|
|
168 |
watermarked_audio = torchaudio.save("output.wav", squeeze, default_sr)
|
169 |
st.audio(watermarked_audio, format="audio/wav")
|
170 |
+
|
171 |
+
#2nd Attempt
|
172 |
+
# watermarked_audio = model(wav, sample_rate=default_sr, alpha=1)
|
173 |
+
# print(watermarked_audio.size())
|
174 |
+
# size = watermarked_audio.size()
|
175 |
+
# st.markdown(size)
|
176 |
+
|
177 |
+
# print(watermarked_audio.squeeze())
|
178 |
+
# squeeze = watermarked_audio.squeeze(1)
|
179 |
+
# shape = squeeze.size()
|
180 |
+
# st.markdown(shape)
|
181 |
+
|
182 |
+
# st.markdown(squeeze)
|
183 |
+
# # watermarked_audio, encode_time_cost = add_watermark(tmp_input_audio_file, watermark_text)
|
184 |
+
# st.write("Watermarked Audio:")
|
185 |
+
# st.markdown(watermarked_audio)
|
186 |
+
# print("watermarked_audio:", watermarked_audio)
|
187 |
+
|
188 |
+
# watermarked_audio = torchaudio.save("output.wav", squeeze, default_sr)
|
189 |
+
# st.audio(watermarked_audio, format="audio/wav")
|
190 |
#st.write("Time Cost: %d seconds" % encode_time_cost)
|
191 |
|
192 |
# # st.button("Add Watermark", disabled=False)
|