Spaces:
Sleeping
Sleeping
Ezi Ozoani
commited on
Commit
•
8385f8f
1
Parent(s):
4ded401
fix build error
Browse files- .DS_Store +0 -0
- app.py +11 -5
- requirements.txt +4 -3
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import time
|
|
|
2 |
import streamlit as st
|
3 |
import os
|
4 |
import torch
|
@@ -6,6 +7,10 @@ import datetime
|
|
6 |
import numpy as np
|
7 |
import soundfile
|
8 |
from wavmark.utils import file_reader
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
def my_read_file(audio_path, max_second):
|
@@ -35,17 +40,18 @@ def add_watermark(audio_path, watermark_text):
|
|
35 |
def decode_watermark(audio_path):
|
36 |
assert os.path.exists(audio_path)
|
37 |
|
38 |
-
|
39 |
signal, sr, audio_length_second = my_read_file(audio_path, max_second_decode)
|
40 |
payload_decoded, _ = wavmark.decode_watermark(model, signal, show_progress=False)
|
41 |
-
decode_cost = time.time() - t1
|
42 |
|
43 |
if payload_decoded is None:
|
44 |
-
|
|
|
45 |
|
46 |
payload_decoded_str = "".join([str(i) for i in payload_decoded])
|
47 |
st.write("Result:", payload_decoded_str)
|
48 |
-
|
49 |
|
50 |
|
51 |
def create_default_value():
|
@@ -59,7 +65,7 @@ def create_default_value():
|
|
59 |
def main():
|
60 |
create_default_value()
|
61 |
|
62 |
-
|
63 |
markdown_text = """
|
64 |
# Audio WaterMarking
|
65 |
You can upload an audio file and encode a custom 16-bit watermark or perform decoding from a watermarked audio.
|
|
|
1 |
import time
|
2 |
+
import wavmark
|
3 |
import streamlit as st
|
4 |
import os
|
5 |
import torch
|
|
|
7 |
import numpy as np
|
8 |
import soundfile
|
9 |
from wavmark.utils import file_reader
|
10 |
+
import subprocess
|
11 |
+
import sys
|
12 |
+
import time
|
13 |
+
|
14 |
|
15 |
|
16 |
def my_read_file(audio_path, max_second):
|
|
|
40 |
def decode_watermark(audio_path):
|
41 |
assert os.path.exists(audio_path)
|
42 |
|
43 |
+
#t1 = time.time()
|
44 |
signal, sr, audio_length_second = my_read_file(audio_path, max_second_decode)
|
45 |
payload_decoded, _ = wavmark.decode_watermark(model, signal, show_progress=False)
|
46 |
+
#decode_cost = time.time() - t1
|
47 |
|
48 |
if payload_decoded is None:
|
49 |
+
#return "No Watermark" , decode_cost
|
50 |
+
return "No Watermark"
|
51 |
|
52 |
payload_decoded_str = "".join([str(i) for i in payload_decoded])
|
53 |
st.write("Result:", payload_decoded_str)
|
54 |
+
#st.write("Time Cost:%d seconds" % (decode_cost))
|
55 |
|
56 |
|
57 |
def create_default_value():
|
|
|
65 |
def main():
|
66 |
create_default_value()
|
67 |
|
68 |
+
st.title("AudioWaterMarking")
|
69 |
markdown_text = """
|
70 |
# Audio WaterMarking
|
71 |
You can upload an audio file and encode a custom 16-bit watermark or perform decoding from a watermarked audio.
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
audioread==3.0.1
|
2 |
certifi==2023.11.17
|
3 |
cffi==1.16.0
|
@@ -32,14 +33,14 @@ resampy==0.4.2
|
|
32 |
scikit-learn==1.4.0
|
33 |
scipy==1.12.0
|
34 |
simpleaudio==1.0.4
|
35 |
-
soundfile
|
36 |
soxr==0.3.7
|
37 |
sympy==1.12
|
38 |
threadpoolctl==3.2.0
|
39 |
-
torch
|
40 |
torchaudio==2.1.2
|
41 |
tqdm==4.66.1
|
42 |
typing_extensions==4.9.0
|
43 |
urllib3==2.1.0
|
44 |
-
wavmark
|
45 |
|
|
|
1 |
+
git+https://github.com/wavmark/wavmark
|
2 |
audioread==3.0.1
|
3 |
certifi==2023.11.17
|
4 |
cffi==1.16.0
|
|
|
33 |
scikit-learn==1.4.0
|
34 |
scipy==1.12.0
|
35 |
simpleaudio==1.0.4
|
36 |
+
soundfile
|
37 |
soxr==0.3.7
|
38 |
sympy==1.12
|
39 |
threadpoolctl==3.2.0
|
40 |
+
torch==2.1.2
|
41 |
torchaudio==2.1.2
|
42 |
tqdm==4.66.1
|
43 |
typing_extensions==4.9.0
|
44 |
urllib3==2.1.0
|
45 |
+
wavmark==0.0.3
|
46 |
|