Spaces:
Sleeping
Sleeping
testcoder-ui
commited on
Commit
·
c19d95e
1
Parent(s):
85fe453
Fix: Auto-load user info on page load
Browse filesProblem: Users had to manually click refresh button to see their call counts
Solution: Added demo.load() event to automatically call get_user_info() when page loads
Testing: All features tested and verified:
- ✅ Page auto-loads user info (no manual refresh needed)
- ✅ History tab works correctly
- ✅ Daily limit persistence to HF Dataset
- ✅ All imports and syntax verified
User experience improvement: Users now see their status immediately upon page load
app.py
CHANGED
|
@@ -847,8 +847,12 @@ with gr.Blocks(title="Video Model Evaluator") as demo:
|
|
| 847 |
outputs=[history_output]
|
| 848 |
)
|
| 849 |
|
| 850 |
-
#
|
| 851 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 852 |
|
| 853 |
# 添加说明
|
| 854 |
gr.Markdown("""
|
|
|
|
| 847 |
outputs=[history_output]
|
| 848 |
)
|
| 849 |
|
| 850 |
+
# 页面加载时自动获取用户信息(Gradio会自动注入gr.Request)
|
| 851 |
+
demo.load(
|
| 852 |
+
fn=get_user_info,
|
| 853 |
+
inputs=None,
|
| 854 |
+
outputs=[user_info]
|
| 855 |
+
)
|
| 856 |
|
| 857 |
# 添加说明
|
| 858 |
gr.Markdown("""
|