Orion-zhen commited on
Commit
db765cd
·
verified ·
1 Parent(s): 11bf0d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -26
app.py CHANGED
@@ -59,6 +59,13 @@ def tokenize_text(
59
  "cls_token",
60
  "unk_token",
61
  "mask_token",
 
 
 
 
 
 
 
62
  ]
63
  special_tokens = {}
64
  for token_name in sp_token_list:
@@ -136,24 +143,21 @@ char_count = gr.Number(label="Character Count", value=0, interactive=False)
136
  with gr.Blocks(title="Token Visualizer", theme="NoCrypt/miku") as webui:
137
  banner.render()
138
 
139
- with gr.Column():
140
- with gr.Row():
141
- with gr.Column():
142
- model_selector.render()
143
- text_input.render()
144
- submit_btn.render()
145
- with gr.Column():
146
- with gr.Accordion("Details", open=False):
147
- with gr.Row():
148
- tokenizer_type.render()
149
- vocab_size.render()
150
- sp_tokens.render()
151
- with gr.Row():
152
- token_count.render()
153
- char_count.render()
154
-
155
  with gr.Column():
 
 
 
156
  output_html.render()
 
 
 
 
 
 
 
 
 
157
 
158
  # 定义CSS样式
159
  webui.css = """
@@ -165,16 +169,6 @@ with gr.Blocks(title="Token Visualizer", theme="NoCrypt/miku") as webui:
165
  font-weight: bold !important;
166
  color: #2c3e50 !important;
167
  }
168
- .gradio-container { /* 针对 Gradio 的主容器 */
169
- width: 100%; /* 根据需要调整宽度 */
170
- display: flex;
171
- justify-content: center;
172
- align-items: center;
173
- }
174
- .gradio-container > div { /* 直接子元素,通常包含你的内容 */
175
- width: 90%; /* 或者你想要的固定宽度 */
176
- max-width: 1200px; /* 设置最大宽度 */
177
- }
178
  """
179
 
180
  submit_btn.click(
 
59
  "cls_token",
60
  "unk_token",
61
  "mask_token",
62
+ "image_token",
63
+ "audio_token",
64
+ "video_token",
65
+ "vision_bos_token",
66
+ "vision_eos_token",
67
+ "audio_bos_token",
68
+ "audio_eos_token",
69
  ]
70
  special_tokens = {}
71
  for token_name in sp_token_list:
 
143
  with gr.Blocks(title="Token Visualizer", theme="NoCrypt/miku") as webui:
144
  banner.render()
145
 
146
+ with gr.Row(scale=2):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  with gr.Column():
148
+ model_selector.render()
149
+ text_input.render()
150
+ submit_btn.render()
151
  output_html.render()
152
+ with gr.Column():
153
+ with gr.Accordion("Details", open=False):
154
+ with gr.Row():
155
+ tokenizer_type.render()
156
+ vocab_size.render()
157
+ sp_tokens.render()
158
+ with gr.Row():
159
+ token_count.render()
160
+ char_count.render()
161
 
162
  # 定义CSS样式
163
  webui.css = """
 
169
  font-weight: bold !important;
170
  color: #2c3e50 !important;
171
  }
 
 
 
 
 
 
 
 
 
 
172
  """
173
 
174
  submit_btn.click(