wagner-austin
commited on
Commit
·
3f49c4e
1
Parent(s):
2f260e9
Enhance: Add input_text.change listener for instant example row transliteration
Browse files
app.py
CHANGED
|
@@ -75,12 +75,19 @@ with gr.Blocks(title="Turkic Transliteration Demo") as demo:
|
|
| 75 |
]
|
| 76 |
gr.Examples(examples, [input_text, lang, output_format])
|
| 77 |
|
| 78 |
-
# Live preview: update output
|
| 79 |
input_text.input(
|
| 80 |
fn=transliterate,
|
| 81 |
inputs=[input_text, lang, include_arabic, output_format],
|
| 82 |
outputs=[output_text, stats]
|
| 83 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
lang.change(
|
| 86 |
fn=transliterate,
|
|
|
|
| 75 |
]
|
| 76 |
gr.Examples(examples, [input_text, lang, output_format])
|
| 77 |
|
| 78 |
+
# Live preview: update output while the user types
|
| 79 |
input_text.input(
|
| 80 |
fn=transliterate,
|
| 81 |
inputs=[input_text, lang, include_arabic, output_format],
|
| 82 |
outputs=[output_text, stats]
|
| 83 |
)
|
| 84 |
+
|
| 85 |
+
# Also fire when the textbox's value finishes changing (e.g., clicking an example)
|
| 86 |
+
input_text.change(
|
| 87 |
+
fn=transliterate,
|
| 88 |
+
inputs=[input_text, lang, include_arabic, output_format],
|
| 89 |
+
outputs=[output_text, stats]
|
| 90 |
+
)
|
| 91 |
|
| 92 |
lang.change(
|
| 93 |
fn=transliterate,
|