Luigi commited on
Commit
6bcfde9
·
1 Parent(s): e71023c

update layout

Browse files
Files changed (1) hide show
  1. app.py +14 -16
app.py CHANGED
@@ -60,10 +60,10 @@ def append_suggestion(current, choice):
60
  text = choice.split(". ", 1)[1] if ". " in choice else choice
61
  return current + text
62
 
63
- # 自訂 CSS:模擬經典中文輸入法候選欄樣式,並使輸入框彈性伸展
64
  custom_css = """
65
  #suggestions-bar {
66
- margin-right: 8px;
67
  }
68
  #suggestions-bar .candidate-list {
69
  display: flex;
@@ -91,9 +91,6 @@ custom_css = """
91
  background: #e6f7ff;
92
  border: 1px solid #1890ff;
93
  }
94
- #input-box {
95
- flex: 1;
96
- }
97
  """
98
 
99
  with gr.Blocks(css=custom_css) as demo:
@@ -103,18 +100,19 @@ with gr.Blocks(css=custom_css) as demo:
103
  "結合小型語言模型與 ZeroGPU,提供即時輸入法風格候選欄。"
104
  )
105
 
106
- # 候選條與輸入框並排
107
- with gr.Row():
108
- suggestions = gr.Radio(
109
- [], label="", interactive=True, type="value",
110
- elem_id="suggestions-bar", elem_classes="candidate-list"
111
- )
112
- input_text = gr.Textbox(
113
- label="", placeholder="請輸入拼音或文字…",
114
- lines=1, max_lines=1, elem_id="input-box"
115
- )
 
116
 
117
- # 預測按鈕(置於下方)
118
  predict_button = gr.Button("預測", elem_id="predict-button")
119
 
120
  # 進階參數設定(可摺疊)
 
60
  text = choice.split(". ", 1)[1] if ". " in choice else choice
61
  return current + text
62
 
63
+ # 自訂 CSS:模擬經典中文輸入法候選欄樣式
64
  custom_css = """
65
  #suggestions-bar {
66
+ margin-bottom: 8px;
67
  }
68
  #suggestions-bar .candidate-list {
69
  display: flex;
 
91
  background: #e6f7ff;
92
  border: 1px solid #1890ff;
93
  }
 
 
 
94
  """
95
 
96
  with gr.Blocks(css=custom_css) as demo:
 
100
  "結合小型語言模型與 ZeroGPU,提供即時輸入法風格候選欄。"
101
  )
102
 
103
+ # 候選條(置於上方)
104
+ suggestions = gr.Radio(
105
+ [], label="", interactive=True, type="value",
106
+ elem_id="suggestions-bar", elem_classes="candidate-list"
107
+ )
108
+
109
+ # 輸入框(置於候選條下方)
110
+ input_text = gr.Textbox(
111
+ label="", placeholder="請輸入拼音或文字…",
112
+ lines=1, max_lines=1, elem_id="input-box"
113
+ )
114
 
115
+ # 預測按鈕(置於文字框下方)
116
  predict_button = gr.Button("預測", elem_id="predict-button")
117
 
118
  # 進階參數設定(可摺疊)