Spaces:
Runtime error
Runtime error
my commited on
Commit ·
3f2e082
1
Parent(s): 2394128
Add application file
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ def add_watermark(audio_path, watermark_text):
|
|
| 25 |
_, signal_wmd, time_cost = wm_add_v2.add_watermark(watermark, data, 16000, 0.1, device, model)
|
| 26 |
|
| 27 |
tmp_file_name = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') + "_" + str(uuid.uuid4()) + ".wav"
|
| 28 |
-
tmp_file_path = '
|
| 29 |
soundfile.write(tmp_file_path, signal_wmd, sr)
|
| 30 |
return tmp_file_path
|
| 31 |
|
|
@@ -64,7 +64,7 @@ def main():
|
|
| 64 |
if action == "Add Watermark":
|
| 65 |
audio_file = st.file_uploader("Upload Audio File (WAV)", type=["wav"], accept_multiple_files=False)
|
| 66 |
if audio_file:
|
| 67 |
-
tmp_input_audio_file = os.path.join("
|
| 68 |
with open(tmp_input_audio_file, "wb") as f:
|
| 69 |
f.write(audio_file.getbuffer())
|
| 70 |
st.audio(tmp_input_audio_file, format="audio/wav")
|
|
@@ -94,7 +94,7 @@ def main():
|
|
| 94 |
if audio_file:
|
| 95 |
if st.button("Decode Watermark"):
|
| 96 |
# 1.保存
|
| 97 |
-
tmp_file_for_decode_path = os.path.join("
|
| 98 |
with open(tmp_file_for_decode_path, "wb") as f:
|
| 99 |
f.write(audio_file.getbuffer())
|
| 100 |
|
|
|
|
| 25 |
_, signal_wmd, time_cost = wm_add_v2.add_watermark(watermark, data, 16000, 0.1, device, model)
|
| 26 |
|
| 27 |
tmp_file_name = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') + "_" + str(uuid.uuid4()) + ".wav"
|
| 28 |
+
tmp_file_path = '/tmp/' + tmp_file_name
|
| 29 |
soundfile.write(tmp_file_path, signal_wmd, sr)
|
| 30 |
return tmp_file_path
|
| 31 |
|
|
|
|
| 64 |
if action == "Add Watermark":
|
| 65 |
audio_file = st.file_uploader("Upload Audio File (WAV)", type=["wav"], accept_multiple_files=False)
|
| 66 |
if audio_file:
|
| 67 |
+
tmp_input_audio_file = os.path.join("/tmp/", audio_file.name)
|
| 68 |
with open(tmp_input_audio_file, "wb") as f:
|
| 69 |
f.write(audio_file.getbuffer())
|
| 70 |
st.audio(tmp_input_audio_file, format="audio/wav")
|
|
|
|
| 94 |
if audio_file:
|
| 95 |
if st.button("Decode Watermark"):
|
| 96 |
# 1.保存
|
| 97 |
+
tmp_file_for_decode_path = os.path.join("/tmp/", audio_file.name)
|
| 98 |
with open(tmp_file_for_decode_path, "wb") as f:
|
| 99 |
f.write(audio_file.getbuffer())
|
| 100 |
|