Enhance disable on example click
Browse files
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
|
304 |
-
return example, False
|
305 |
-
|
306 |
gr.Examples(
|
307 |
examples=examples,
|
308 |
inputs=prompt,
|
309 |
outputs=[prompt, use_prompt_enrichment],
|
310 |
-
fn=
|
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 |
|