Daryl Lim Claude Sonnet 4.6 commited on
Commit
12ff0ac
·
1 Parent(s): 57a1d31

feat: increase textbox height to 6 lines and remove input placeholder

Browse files
Files changed (2) hide show
  1. app.py +2 -3
  2. tests/test_app.py +21 -0
app.py CHANGED
@@ -102,8 +102,7 @@ def _build_demo() -> gr.Blocks:
102
  interactive=False,
103
  )
104
  input_text = gr.Textbox(
105
- placeholder="Enter English text here",
106
- lines=4,
107
  show_label=False,
108
  )
109
  char_count = gr.Markdown("0 characters")
@@ -116,7 +115,7 @@ def _build_demo() -> gr.Blocks:
116
  )
117
  output_text = gr.Textbox(
118
  placeholder="Translation",
119
- lines=4,
120
  show_label=False,
121
  interactive=False,
122
  buttons=["copy"],
 
102
  interactive=False,
103
  )
104
  input_text = gr.Textbox(
105
+ lines=6,
 
106
  show_label=False,
107
  )
108
  char_count = gr.Markdown("0 characters")
 
115
  )
116
  output_text = gr.Textbox(
117
  placeholder="Translation",
118
+ lines=6,
119
  show_label=False,
120
  interactive=False,
121
  buttons=["copy"],
tests/test_app.py CHANGED
@@ -180,6 +180,27 @@ def test_dropdown_choices_include_locale_codes(demo):
180
  assert all("(" in label and ")" in label for label in labels), f"Expected locale codes in choices: {labels}"
181
 
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  # --- Slow tests (require CUDA + model download) ---
184
 
185
  gpu_available = torch.cuda.is_available()
 
180
  assert all("(" in label and ")" in label for label in labels), f"Expected locale codes in choices: {labels}"
181
 
182
 
183
+ def test_input_textbox_height(demo):
184
+ """Input textbox should use lines=6."""
185
+ textboxes = [b for b in demo.blocks.values() if type(b).__name__ == "Textbox"]
186
+ interactive = [t for t in textboxes if t.interactive is not False]
187
+ assert interactive[0].lines == 6, f"Expected lines=6, got {interactive[0].lines}"
188
+
189
+
190
+ def test_output_textbox_height(demo):
191
+ """Output textbox should use lines=6."""
192
+ textboxes = [b for b in demo.blocks.values() if type(b).__name__ == "Textbox"]
193
+ non_interactive = [t for t in textboxes if t.interactive is False]
194
+ assert non_interactive[0].lines == 6, f"Expected lines=6, got {non_interactive[0].lines}"
195
+
196
+
197
+ def test_input_textbox_has_no_placeholder(demo):
198
+ """Input textbox should have no placeholder text."""
199
+ textboxes = [b for b in demo.blocks.values() if type(b).__name__ == "Textbox"]
200
+ interactive = [t for t in textboxes if t.interactive is not False]
201
+ assert interactive[0].placeholder is None, f"Expected no placeholder, got {interactive[0].placeholder!r}"
202
+
203
+
204
  # --- Slow tests (require CUDA + model download) ---
205
 
206
  gpu_available = torch.cuda.is_available()