Spaces:
Running
Running
Daryl Lim commited on
Commit ·
8f6717a
1
Parent(s): 29c2951
refactor: remove hint and character count from UI
Browse files
app.py
CHANGED
|
@@ -86,18 +86,6 @@ def translate(
|
|
| 86 |
return result
|
| 87 |
|
| 88 |
|
| 89 |
-
def _format_info(char_count: int) -> str:
|
| 90 |
-
return (
|
| 91 |
-
f'<p style="font-size: var(--block-info-text-size); color: var(--block-info-text-color); margin: 4px 0 0 0;">'
|
| 92 |
-
f"Press Ctrl+Enter to apply · {char_count:,} / 2,000"
|
| 93 |
-
f"</p>"
|
| 94 |
-
)
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
def _update_char_count(text: str) -> str:
|
| 98 |
-
return _format_info(len(text))
|
| 99 |
-
|
| 100 |
-
|
| 101 |
def _translate_with_loading(
|
| 102 |
text: str,
|
| 103 |
target_language_name: str,
|
|
@@ -125,7 +113,6 @@ def _build_demo() -> gr.Blocks:
|
|
| 125 |
show_label=False,
|
| 126 |
buttons=["clear"],
|
| 127 |
)
|
| 128 |
-
input_info = gr.HTML(value=_format_info(0))
|
| 129 |
translate_btn = gr.Button("Translate", variant="primary")
|
| 130 |
with gr.Column():
|
| 131 |
target_language = gr.Dropdown(
|
|
@@ -152,11 +139,6 @@ def _build_demo() -> gr.Blocks:
|
|
| 152 |
inputs=[input_text, target_language],
|
| 153 |
outputs=output_text,
|
| 154 |
)
|
| 155 |
-
input_text.change(
|
| 156 |
-
fn=_update_char_count,
|
| 157 |
-
inputs=input_text,
|
| 158 |
-
outputs=input_info,
|
| 159 |
-
)
|
| 160 |
|
| 161 |
return demo
|
| 162 |
|
|
|
|
| 86 |
return result
|
| 87 |
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
def _translate_with_loading(
|
| 90 |
text: str,
|
| 91 |
target_language_name: str,
|
|
|
|
| 113 |
show_label=False,
|
| 114 |
buttons=["clear"],
|
| 115 |
)
|
|
|
|
| 116 |
translate_btn = gr.Button("Translate", variant="primary")
|
| 117 |
with gr.Column():
|
| 118 |
target_language = gr.Dropdown(
|
|
|
|
| 139 |
inputs=[input_text, target_language],
|
| 140 |
outputs=output_text,
|
| 141 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
return demo
|
| 144 |
|