Spaces:
Paused
Paused
UX Optimizations (#3)
Browse files- Update the Generate button value and interactivity to clarify when the system is generating (7894bef49b93a70c3210ef5bbad5db2f1e516651)
- Provide only a single hands-on example, to expedite generation (8834ce585ba6b459b6d72c9c0b9850d24daaa16b)
- Fix typos (9706b48ae93bf82579e585fa19bc3c7e3195c335)
- Update the Space title, so that browser tabs use the standard capitalization (ee678658c03554a8e5ffa381d11c2f0ae4ba9b25)
Co-authored-by: Neal DeBuhr <ndebuhr@users.noreply.huggingface.co>
12345---title: Synthid Textemoji: 🏃colorFrom: pinkcolorTo: gray12345---title: SynthID Textemoji: 🏃colorFrom: pinkcolorTo: gray
22 unmodified lines2324252627282930113 unmodified lines14414514614714814915015115215315415515658 unmodified lines21521621721821922022122222322419 unmodified lines2442452462472482492502 unmodified lines25325425525625725825917 unmodified lines27727827928028128228370 unmodified lines35435535635735835942 unmodified lines40240340440540640740822 unmodified lines_PROMPTS: Tuple[str] = ('Write an essay about my pets, a cat named Mika and a dog named Cleo.','Tell me everything you can about Portugal.','What is Hugging Face?',)_TORCH_DEVICE = (113 unmodified lines1. How to use SynthID Text to apply a watermark to text generated by yourmodel; and1. How to indetify that text using a ready-made detector.Note that this detector is trained specifically fore this demonstration. Youshould maintain a specific watermarking configuration for every model youuse and protect that configuration as you would any other secret. See the[end-to-end guide][synthid-hf-detector-e2e] for more on training your owndetectors, and the [SynthID Text documentaiton][raitk-synthid] for more onhow this technology works.## Applying a watermark58 unmodified linesLets use [Gemma 2B IT][gemma] to help you understand how watermarking works.Using the text boxes below enter up to three prompts then click the generatebutton. Some examples are provided to help get you started, but they arefully editable.Gemma will then generate watermarked and non-watermarked repsonses for eachnon-empty prompt you provided.[cloud-parameter-values]: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values19 unmodified lines## Human recognition of watermarked textThe primary goal of SynthID Text is to apply a watermark to generated textwihtout affecting generation quality. Another way to think about this isthat generated text that carries a watermark should be imperceptible toyou, the reader, but easily perceived by a watermark detector.2 unmodified linessee the true values.The [research paper][synthid-nature] has an in-depth study examining humanperception of watermared versus non-watermarked text.[synthid-nature]: https://www.nature.com/articles/s41586-024-08025-4'''17 unmodified lines[end-to-end example][synthid-hf-detector-e2e] of how to train one of thesedetectors.You can see how your guesses compared to the actaul results below. Asabove, the responses are displayed in checkboxes. If the box is checked,then the text carries a watermark. Your correct guesses are annotated withthe "Correct" prefix.70 unmodified lines}generate_btn.click(generate,inputs=prompt_inputs,outputs=[generate_btn, generations_col, generations_grp, reveal_btn]42 unmodified linesdetections_col: gr.Column(visible=False),revealed_grp: gr.CheckboxGroup(visible=False),reset_btn: gr.Button(visible=False),generate_btn: gr.Button(visible=True),}reset_btn.click(22 unmodified lines2324252627282930113 unmodified lines14414514614714814915015115215315415515658 unmodified lines21521621721821922022122222322419 unmodified lines2442452462472482492502 unmodified lines25325425525625725825917 unmodified lines27727827928028128228370 unmodified lines35435535635735835936036142 unmodified lines40440540640740840941022 unmodified lines_PROMPTS: Tuple[str] = ('Write an essay about my pets, a cat named Mika and a dog named Cleo.','','',)_TORCH_DEVICE = (113 unmodified lines1. How to use SynthID Text to apply a watermark to text generated by yourmodel; and1. How to identify that text using a ready-made detector.Note that this detector is trained specifically for this demonstration. Youshould maintain a specific watermarking configuration for every model youuse and protect that configuration as you would any other secret. See the[end-to-end guide][synthid-hf-detector-e2e] for more on training your owndetectors, and the [SynthID Text documentation][raitk-synthid] for more onhow this technology works.## Applying a watermark58 unmodified linesLets use [Gemma 2B IT][gemma] to help you understand how watermarking works.Using the text boxes below enter up to three prompts then click the generatebutton. An example is provided to help get you started, but the cells arefully editable.Gemma will then generate watermarked and non-watermarked responses for eachnon-empty prompt you provided.[cloud-parameter-values]: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values19 unmodified lines## Human recognition of watermarked textThe primary goal of SynthID Text is to apply a watermark to generated textwithout affecting generation quality. Another way to think about this isthat generated text that carries a watermark should be imperceptible toyou, the reader, but easily perceived by a watermark detector.2 unmodified linessee the true values.The [research paper][synthid-nature] has an in-depth study examining humanperception of watermarked versus non-watermarked text.[synthid-nature]: https://www.nature.com/articles/s41586-024-08025-4'''17 unmodified lines[end-to-end example][synthid-hf-detector-e2e] of how to train one of thesedetectors.You can see how your guesses compared to the actual results below. Asabove, the responses are displayed in checkboxes. If the box is checked,then the text carries a watermark. Your correct guesses are annotated withthe "Correct" prefix.70 unmodified lines}generate_btn.click(lambda: gr.update(value='Generating...', interactive=False), None, generate_btn).then(generate,inputs=prompt_inputs,outputs=[generate_btn, generations_col, generations_grp, reveal_btn]42 unmodified linesdetections_col: gr.Column(visible=False),revealed_grp: gr.CheckboxGroup(visible=False),reset_btn: gr.Button(visible=False),generate_btn: gr.Button(value='Generate', interactive=True, visible=True),}reset_btn.click(
README.md+1-1
app.py+13-11