always show prediction button
Browse files
app.py
CHANGED
|
@@ -145,12 +145,13 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 145 |
lines=1, max_lines=20, elem_id="input-box"
|
| 146 |
)
|
| 147 |
|
|
|
|
| 148 |
with gr.Row():
|
| 149 |
auto_predict = gr.Checkbox(
|
| 150 |
value=True, label="自動預測(內容變更時觸發)", elem_id="auto-predict"
|
| 151 |
)
|
| 152 |
predict_button = gr.Button(
|
| 153 |
-
"預測", elem_id="predict-button"
|
| 154 |
)
|
| 155 |
|
| 156 |
with gr.Accordion("進階設定", open=False):
|
|
@@ -164,11 +165,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 164 |
minimum=1, maximum=30, step=1, value=6, label="M(建議數/Beam 數)"
|
| 165 |
)
|
| 166 |
|
| 167 |
-
|
| 168 |
-
fn=lambda auto: update(visible=not auto),
|
| 169 |
-
inputs=[auto_predict],
|
| 170 |
-
outputs=[predict_button],
|
| 171 |
-
)
|
| 172 |
predict_button.click(
|
| 173 |
fn=suggest_next,
|
| 174 |
inputs=[input_text, model_selector, k_slider, m_slider],
|
|
|
|
| 145 |
lines=1, max_lines=20, elem_id="input-box"
|
| 146 |
)
|
| 147 |
|
| 148 |
+
# 永遠顯示預測按鈕
|
| 149 |
with gr.Row():
|
| 150 |
auto_predict = gr.Checkbox(
|
| 151 |
value=True, label="自動預測(內容變更時觸發)", elem_id="auto-predict"
|
| 152 |
)
|
| 153 |
predict_button = gr.Button(
|
| 154 |
+
"預測", elem_id="predict-button"
|
| 155 |
)
|
| 156 |
|
| 157 |
with gr.Accordion("進階設定", open=False):
|
|
|
|
| 165 |
minimum=1, maximum=30, step=1, value=6, label="M(建議數/Beam 數)"
|
| 166 |
)
|
| 167 |
|
| 168 |
+
# 綁定事件
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
predict_button.click(
|
| 170 |
fn=suggest_next,
|
| 171 |
inputs=[input_text, model_selector, k_slider, m_slider],
|