Update app.py
Browse files
app.py
CHANGED
@@ -197,10 +197,16 @@ def main():
|
|
197 |
#st.write("Time Cost: %d seconds" % encode_time_cost)
|
198 |
|
199 |
# # st.button("Add Watermark", disabled=False)
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
|
206 |
if __name__ == "__main__":
|
@@ -211,6 +217,7 @@ if __name__ == "__main__":
|
|
211 |
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
212 |
# model = wavmark.load_model().to(device)
|
213 |
model = AudioSeal.load_generator("audioseal_wm_16bits")
|
|
|
214 |
main()
|
215 |
|
216 |
# audio_path = "/Users/my/Library/Mobile Documents/com~apple~CloudDocs/CODE/PycharmProjects/4_璇煶姘村嵃/419_huggingface姘村嵃/WavMark/example.wav"
|
|
|
197 |
#st.write("Time Cost: %d seconds" % encode_time_cost)
|
198 |
|
199 |
# # st.button("Add Watermark", disabled=False)
|
200 |
+
elif action == "Detect Watermark":
|
201 |
+
if st.button("Detect"):
|
202 |
+
with st.spinner("Detecting..."):
|
203 |
+
result, message = detector.detect_watermark(watermarked_audio, sample_rate=default_sr, message_threshold=0.5)
|
204 |
+
|
205 |
+
print(f"\nThis is likely a watermarked audio: {result}")
|
206 |
+
|
207 |
+
# Run on an unwatermarked audio
|
208 |
+
result2, message2 = detector.detect_watermark(wav, sample_rate=default_sr, message_threshold=0.5)
|
209 |
+
print(f"This is likely an unwatermarked audio: {result2}")
|
210 |
|
211 |
|
212 |
if __name__ == "__main__":
|
|
|
217 |
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
218 |
# model = wavmark.load_model().to(device)
|
219 |
model = AudioSeal.load_generator("audioseal_wm_16bits")
|
220 |
+
detector = AudioSeal.load_detector(("audioseal_detector_16bits"))
|
221 |
main()
|
222 |
|
223 |
# audio_path = "/Users/my/Library/Mobile Documents/com~apple~CloudDocs/CODE/PycharmProjects/4_璇煶姘村嵃/419_huggingface姘村嵃/WavMark/example.wav"
|