ideprado commited on
Commit
af73a4f
·
1 Parent(s): febc658

Enhance disable on example click

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -298,16 +298,16 @@ with gr.Blocks(css=css, theme="ParityError/Interstellar") as demo:
298
 
299
  # Examples should explicitly target only the prompt input
300
  max_length = 180
301
-
302
  # Function to handle example clicks - sets prompt and disables enrichment
303
- def set_example(example):
304
- return example, False
305
-
306
  gr.Examples(
307
  examples=examples,
308
  inputs=prompt,
309
  outputs=[prompt, use_prompt_enrichment],
310
- fn=set_example,
311
  example_labels=[ex[:max_length] + "..." if len(ex) > max_length else ex for ex in examples]
312
  )
313
 
 
298
 
299
  # Examples should explicitly target only the prompt input
300
  max_length = 180
301
+
302
  # Function to handle example clicks - sets prompt and disables enrichment
303
+ def set_example_and_disable_enrichment(example):
304
+ return example, gr.update(value=False) # Explicitly disable enrichment
305
+
306
  gr.Examples(
307
  examples=examples,
308
  inputs=prompt,
309
  outputs=[prompt, use_prompt_enrichment],
310
+ fn=set_example_and_disable_enrichment, # Use the updated function
311
  example_labels=[ex[:max_length] + "..." if len(ex) > max_length else ex for ex in examples]
312
  )
313