Download watermarking_demoscript.py from SWilliams20/Implementing-Robust-Watermarking-for-Model-Protection: direct link, hf CLI and curl.
- Browser
- Download file 509 Bytes
-
https://huggingface.co/SWilliams20/Implementing-Robust-Watermarking-for-Model-Protection/resolve/main/watermarking_demoscript.py
- Command line
-
hf download hf://SWilliams20/Implementing-Robust-Watermarking-for-Model-Protection/watermarking_demoscript.py
-
curl -L -o watermarking_demoscript.py https://huggingface.co/SWilliams20/Implementing-Robust-Watermarking-for-Model-Protection/resolve/main/watermarking_demoscript.py
509 Bytes
| # demo_script.py | |
| import tensorflow as tf | |
| from watermarking_functions import detect_watermark_LSB | |
| # Load the trained model with the embedded watermark | |
| model_with_watermark = tf.keras.models.load_model('text_classification_model_with_watermark.h5') | |
| # Detect and extract the watermark from the model | |
| detected_watermark = detect_watermark_LSB(model_with_watermark) | |
| if detected_watermark: | |
| print("Watermark Detected:", detected_watermark) | |
| else: | |
| print("No watermark found or watermark detection failed.") |