EugeneXiang commited on
Commit
8ade384
·
verified ·
1 Parent(s): 3d7bbd3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -274,6 +274,7 @@ def evaluate(
274
  title="Final (Max) Scores Radar"
275
  )
276
 
 
277
  return (
278
  gr.update(visible=False), # 隐藏限制提示
279
  gr.update(visible=True), # 显示结果区域
@@ -290,7 +291,8 @@ def evaluate(
290
  judge_remark,
291
  *generate_captcha(), # 生成新的验证码
292
  count, # 返回当前全局计数
293
- "expanded" # Judge区块默认展开
 
294
  )
295
 
296
  def toggle_explain(v):
@@ -304,7 +306,8 @@ def check_daily_limit_state():
304
  gr.update(visible=is_limited), # 限制提示
305
  gr.update(visible=not is_limited), # 启用提交按钮
306
  gr.update(visible=not is_limited), # 显示结果区域
307
- f"Today Counts: {current_count}/{DAILY_LIMIT}"
 
308
  )
309
 
310
  def show_personal_version_notice():
@@ -493,12 +496,9 @@ with gr.Blocks(css=css) as iface:
493
 
494
  submit = gr.Button("Submit", elem_id="submit-btn")
495
 
496
- # 每日评分次数显示
497
- gr.Markdown("""
498
- <div class="daily-count" id="daily-count-display">
499
- Today Counts: <span id="count">0</span>/150
500
- </div>
501
- """)
502
  gr.Markdown("""
503
  <div>
504
  ⚠️ This is a **demo version** of ECHOscore.
@@ -511,7 +511,7 @@ with gr.Blocks(css=css) as iface:
511
  iface.load(
512
  check_daily_limit_state,
513
  None,
514
- [limit_notice, submit, results_area, daily_count]
515
  )
516
 
517
  iface.load(
@@ -541,7 +541,8 @@ with gr.Blocks(css=css) as iface:
541
  judge_remarks_out,
542
  captcha_text, correct_answer,
543
  daily_count,
544
- judge_section_state # 更新Judge区块状态
 
545
  ]
546
  )
547
 
@@ -560,4 +561,4 @@ with gr.Blocks(css=css) as iface:
560
  )
561
 
562
  if __name__ == "__main__":
563
- iface.launch()
 
274
  title="Final (Max) Scores Radar"
275
  )
276
 
277
+ # 更新页面底部的计数器显示
278
  return (
279
  gr.update(visible=False), # 隐藏限制提示
280
  gr.update(visible=True), # 显示结果区域
 
291
  judge_remark,
292
  *generate_captcha(), # 生成新的验证码
293
  count, # 返回当前全局计数
294
+ "expanded", # Judge区块默认展开
295
+ gr.update(value=f"Today Counts: {count}/{DAILY_LIMIT}") # 更新底部计数器
296
  )
297
 
298
  def toggle_explain(v):
 
306
  gr.update(visible=is_limited), # 限制提示
307
  gr.update(visible=not is_limited), # 启用提交按钮
308
  gr.update(visible=not is_limited), # 显示结果区域
309
+ f"Today Counts: {current_count}/{DAILY_LIMIT}", # 更新计数器文本
310
+ gr.update(value=f"Today Counts: {current_count}/{DAILY_LIMIT}") # 更新底部计数器
311
  )
312
 
313
  def show_personal_version_notice():
 
496
 
497
  submit = gr.Button("Submit", elem_id="submit-btn")
498
 
499
+ # 新增:创建一个用于显示底部计数器的组件
500
+ footer_count = gr.Textbox(label="Today's Usage", value="Today Counts: 0/150", interactive=False, visible=True)
501
+
 
 
 
502
  gr.Markdown("""
503
  <div>
504
  ⚠️ This is a **demo version** of ECHOscore.
 
511
  iface.load(
512
  check_daily_limit_state,
513
  None,
514
+ [limit_notice, submit, results_area, daily_count, footer_count] # 添加footer_count
515
  )
516
 
517
  iface.load(
 
541
  judge_remarks_out,
542
  captcha_text, correct_answer,
543
  daily_count,
544
+ judge_section_state, # 更新Judge区块状态
545
+ footer_count # 更新底部计数器
546
  ]
547
  )
548
 
 
561
  )
562
 
563
  if __name__ == "__main__":
564
+ iface.launch()