Update app.py
Browse files
app.py
CHANGED
|
@@ -190,26 +190,28 @@ def main():
|
|
| 190 |
file_name="output.mp3",
|
| 191 |
mime="audio/mpeg",
|
| 192 |
)
|
| 193 |
-
|
|
|
|
|
|
|
| 194 |
elif action == "Detect Watermark":
|
| 195 |
detect_watermark_button = st.button("Detect Watermark", key="detect_watermark_btn")
|
| 196 |
|
| 197 |
-
if audio_file:
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
|
| 205 |
|
| 206 |
if detect_watermark_button:
|
| 207 |
with st.spinner("Detecting..."):
|
| 208 |
-
result, message = detector.detect_watermark(watermarked_audio, sample_rate=default_sr, message_threshold=0.5)
|
| 209 |
-
st.markdown("Probability of audio being watermarked: ")
|
| 210 |
-
st.markdown(result)
|
| 211 |
-
st.markdown("This is likely a watermarked audio!")
|
| 212 |
-
print(f"\nThis is likely a watermarked audio: {result}")
|
| 213 |
|
| 214 |
#Run on an unwatermarked audio
|
| 215 |
|
|
@@ -227,7 +229,7 @@ def main():
|
|
| 227 |
|
| 228 |
result2, message2 = detector.detect_watermark(wav, sample_rate=default_sr, message_threshold=0.5)
|
| 229 |
print(f"This is likely an unwatermarked audio: {result2}")
|
| 230 |
-
st.markdown("Probability of audio being watermarked
|
| 231 |
st.markdown(result2)
|
| 232 |
st.markdown("This is likely an unwatermarked audio!")
|
| 233 |
|
|
|
|
| 190 |
file_name="output.mp3",
|
| 191 |
mime="audio/mpeg",
|
| 192 |
)
|
| 193 |
+
except RuntimeError:
|
| 194 |
+
st.error("Please input audio with one channel (mono-channel)")
|
| 195 |
+
|
| 196 |
elif action == "Detect Watermark":
|
| 197 |
detect_watermark_button = st.button("Detect Watermark", key="detect_watermark_btn")
|
| 198 |
|
| 199 |
+
# if audio_file:
|
| 200 |
+
# #1st attempt
|
| 201 |
+
# watermark = model.get_watermark(wav, default_sr)
|
| 202 |
+
# watermarked_audio = wav + watermark
|
| 203 |
+
# print(watermarked_audio.size())
|
| 204 |
+
# size = watermarked_audio.size()
|
| 205 |
+
# #st.markdown(size)
|
| 206 |
|
| 207 |
|
| 208 |
if detect_watermark_button:
|
| 209 |
with st.spinner("Detecting..."):
|
| 210 |
+
# result, message = detector.detect_watermark(watermarked_audio, sample_rate=default_sr, message_threshold=0.5)
|
| 211 |
+
# st.markdown("Probability of audio being watermarked: ")
|
| 212 |
+
# st.markdown(result)
|
| 213 |
+
# st.markdown("This is likely a watermarked audio!")
|
| 214 |
+
# print(f"\nThis is likely a watermarked audio: {result}")
|
| 215 |
|
| 216 |
#Run on an unwatermarked audio
|
| 217 |
|
|
|
|
| 229 |
|
| 230 |
result2, message2 = detector.detect_watermark(wav, sample_rate=default_sr, message_threshold=0.5)
|
| 231 |
print(f"This is likely an unwatermarked audio: {result2}")
|
| 232 |
+
st.markdown("Probability of audio being watermarked: ")
|
| 233 |
st.markdown(result2)
|
| 234 |
st.markdown("This is likely an unwatermarked audio!")
|
| 235 |
|