csavcak ndebuhr commited on
Commit
4116737
β€’
1 Parent(s): 2b6fecd

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 <[email protected]>

Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +13 -11
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Synthid Text
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
- 'Tell me everything you can about Portugal.',
27
- 'What is Hugging Face?',
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 indetify that text using a ready-made detector.
148
 
149
- Note that this detector is trained specifically fore 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 documentaiton][raitk-synthid] for more on
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. Some examples are provided to help get you started, but they are
219
  fully editable.
220
 
221
- Gemma will then generate watermarked and non-watermarked repsonses 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,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
- wihtout 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,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 watermared versus non-watermarked text.
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 actaul 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,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(