Spaces:
Running
on
L40S
Running
on
L40S
UX Optimizations
#3
by
ndebuhr
- opened
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: π
|
4 |
colorFrom: pink
|
5 |
colorTo: gray
|
|
|
1 |
---
|
2 |
+
title: SynthID Text
|
3 |
emoji: π
|
4 |
colorFrom: pink
|
5 |
colorTo: gray
|
app.py
CHANGED
@@ -23,8 +23,8 @@ _DETECTOR_IDENTIFIER = 'google/synthid-spaces-demo-detector'
|
|
23 |
|
24 |
_PROMPTS: Tuple[str] = (
|
25 |
'Write an essay about my pets, a cat named Mika and a dog named Cleo.',
|
26 |
-
'
|
27 |
-
'
|
28 |
)
|
29 |
|
30 |
_TORCH_DEVICE = (
|
@@ -144,13 +144,13 @@ with gr.Blocks() as demo:
|
|
144 |
|
145 |
1. How to use SynthID Text to apply a watermark to text generated by your
|
146 |
model; and
|
147 |
-
1. How to
|
148 |
|
149 |
-
Note that this detector is trained specifically
|
150 |
should maintain a specific watermarking configuration for every model you
|
151 |
use and protect that configuration as you would any other secret. See the
|
152 |
[end-to-end guide][synthid-hf-detector-e2e] for more on training your own
|
153 |
-
detectors, and the [SynthID Text
|
154 |
how this technology works.
|
155 |
|
156 |
## Applying a watermark
|
@@ -215,10 +215,10 @@ with gr.Blocks() as demo:
|
|
215 |
Lets use [Gemma 2B IT][gemma] to help you understand how watermarking works.
|
216 |
|
217 |
Using the text boxes below enter up to three prompts then click the generate
|
218 |
-
button.
|
219 |
fully editable.
|
220 |
|
221 |
-
Gemma will then generate watermarked and non-watermarked
|
222 |
non-empty prompt you provided.
|
223 |
|
224 |
[cloud-parameter-values]: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values
|
@@ -244,7 +244,7 @@ with gr.Blocks() as demo:
|
|
244 |
## Human recognition of watermarked text
|
245 |
|
246 |
The primary goal of SynthID Text is to apply a watermark to generated text
|
247 |
-
|
248 |
that generated text that carries a watermark should be imperceptible to
|
249 |
you, the reader, but easily perceived by a watermark detector.
|
250 |
|
@@ -253,7 +253,7 @@ with gr.Blocks() as demo:
|
|
253 |
see the true values.
|
254 |
|
255 |
The [research paper][synthid-nature] has an in-depth study examining human
|
256 |
-
perception of
|
257 |
|
258 |
[synthid-nature]: https://www.nature.com/articles/s41586-024-08025-4
|
259 |
'''
|
@@ -277,7 +277,7 @@ with gr.Blocks() as demo:
|
|
277 |
[end-to-end example][synthid-hf-detector-e2e] of how to train one of these
|
278 |
detectors.
|
279 |
|
280 |
-
You can see how your guesses compared to the
|
281 |
above, the responses are displayed in checkboxes. If the box is checked,
|
282 |
then the text carries a watermark. Your correct guesses are annotated with
|
283 |
the "Correct" prefix.
|
@@ -354,6 +354,8 @@ with gr.Blocks() as demo:
|
|
354 |
}
|
355 |
|
356 |
generate_btn.click(
|
|
|
|
|
357 |
generate,
|
358 |
inputs=prompt_inputs,
|
359 |
outputs=[generate_btn, generations_col, generations_grp, reveal_btn]
|
@@ -402,7 +404,7 @@ with gr.Blocks() as demo:
|
|
402 |
detections_col: gr.Column(visible=False),
|
403 |
revealed_grp: gr.CheckboxGroup(visible=False),
|
404 |
reset_btn: gr.Button(visible=False),
|
405 |
-
generate_btn: gr.Button(visible=True),
|
406 |
}
|
407 |
|
408 |
reset_btn.click(
|
|
|
23 |
|
24 |
_PROMPTS: Tuple[str] = (
|
25 |
'Write an essay about my pets, a cat named Mika and a dog named Cleo.',
|
26 |
+
'',
|
27 |
+
'',
|
28 |
)
|
29 |
|
30 |
_TORCH_DEVICE = (
|
|
|
144 |
|
145 |
1. How to use SynthID Text to apply a watermark to text generated by your
|
146 |
model; and
|
147 |
+
1. How to identify that text using a ready-made detector.
|
148 |
|
149 |
+
Note that this detector is trained specifically for this demonstration. You
|
150 |
should maintain a specific watermarking configuration for every model you
|
151 |
use and protect that configuration as you would any other secret. See the
|
152 |
[end-to-end guide][synthid-hf-detector-e2e] for more on training your own
|
153 |
+
detectors, and the [SynthID Text documentation][raitk-synthid] for more on
|
154 |
how this technology works.
|
155 |
|
156 |
## Applying a watermark
|
|
|
215 |
Lets use [Gemma 2B IT][gemma] to help you understand how watermarking works.
|
216 |
|
217 |
Using the text boxes below enter up to three prompts then click the generate
|
218 |
+
button. An example is provided to help get you started, but the cells are
|
219 |
fully editable.
|
220 |
|
221 |
+
Gemma will then generate watermarked and non-watermarked responses for each
|
222 |
non-empty prompt you provided.
|
223 |
|
224 |
[cloud-parameter-values]: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values
|
|
|
244 |
## Human recognition of watermarked text
|
245 |
|
246 |
The primary goal of SynthID Text is to apply a watermark to generated text
|
247 |
+
without affecting generation quality. Another way to think about this is
|
248 |
that generated text that carries a watermark should be imperceptible to
|
249 |
you, the reader, but easily perceived by a watermark detector.
|
250 |
|
|
|
253 |
see the true values.
|
254 |
|
255 |
The [research paper][synthid-nature] has an in-depth study examining human
|
256 |
+
perception of watermarked versus non-watermarked text.
|
257 |
|
258 |
[synthid-nature]: https://www.nature.com/articles/s41586-024-08025-4
|
259 |
'''
|
|
|
277 |
[end-to-end example][synthid-hf-detector-e2e] of how to train one of these
|
278 |
detectors.
|
279 |
|
280 |
+
You can see how your guesses compared to the actual results below. As
|
281 |
above, the responses are displayed in checkboxes. If the box is checked,
|
282 |
then the text carries a watermark. Your correct guesses are annotated with
|
283 |
the "Correct" prefix.
|
|
|
354 |
}
|
355 |
|
356 |
generate_btn.click(
|
357 |
+
lambda: gr.update(value='Generating...', interactive=False), None, generate_btn
|
358 |
+
).then(
|
359 |
generate,
|
360 |
inputs=prompt_inputs,
|
361 |
outputs=[generate_btn, generations_col, generations_grp, reveal_btn]
|
|
|
404 |
detections_col: gr.Column(visible=False),
|
405 |
revealed_grp: gr.CheckboxGroup(visible=False),
|
406 |
reset_btn: gr.Button(visible=False),
|
407 |
+
generate_btn: gr.Button(value='Generate', interactive=True, visible=True),
|
408 |
}
|
409 |
|
410 |
reset_btn.click(
|