Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3110,19 +3110,20 @@ def wire_single_chart_section(
|
|
| 3110 |
logs_component,
|
| 3111 |
username_component,
|
| 3112 |
year_component,
|
|
|
|
| 3113 |
prepare_fn,
|
| 3114 |
fetch_fn,
|
| 3115 |
rerender_fn,
|
| 3116 |
):
|
| 3117 |
fetch_button.click(
|
| 3118 |
fn=prepare_fn,
|
| 3119 |
-
inputs=[username_component, year_component],
|
| 3120 |
outputs=context_box,
|
| 3121 |
show_progress="hidden",
|
| 3122 |
).then(
|
| 3123 |
fn=fetch_fn,
|
| 3124 |
inputs=[state_component, username_component, year_component, mode_component],
|
| 3125 |
-
outputs=[state_component, context_box, chart_component, logs_component, mode_component],
|
| 3126 |
show_progress="full",
|
| 3127 |
show_progress_on=[chart_component, logs_component],
|
| 3128 |
)
|
|
@@ -3696,6 +3697,10 @@ maybe_reset_section_handlers = {
|
|
| 3696 |
}
|
| 3697 |
|
| 3698 |
with gr.Blocks(title="HF Contributions") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3699 |
app_state = gr.State(value=None)
|
| 3700 |
community_state = gr.State(value=None)
|
| 3701 |
space_updates_state = gr.State(value=None)
|
|
@@ -3914,7 +3919,7 @@ with gr.Blocks(title="HF Contributions") as demo:
|
|
| 3914 |
|
| 3915 |
demo.load(
|
| 3916 |
fn=hydrate_header_on_load,
|
| 3917 |
-
inputs=[username, selected_year],
|
| 3918 |
outputs=[username, context_box, community_context_box]
|
| 3919 |
+ [single_section_components[k]["context_box"] for k in ("upvotes", "likes", "papers")]
|
| 3920 |
+ [space_updates_context_box],
|
|
@@ -3923,12 +3928,12 @@ with gr.Blocks(title="HF Contributions") as demo:
|
|
| 3923 |
|
| 3924 |
repo_chain = run_button.click(
|
| 3925 |
fn=prepare_repo_fetch_ui,
|
| 3926 |
-
inputs=[username, selected_year, visibility_mode],
|
| 3927 |
outputs=[context_box, visibility_mode],
|
| 3928 |
show_progress="hidden",
|
| 3929 |
).then(
|
| 3930 |
fn=fetch_and_render_repo_only,
|
| 3931 |
-
inputs=[username, selected_year, visibility_mode],
|
| 3932 |
outputs=repo_fetch_outputs,
|
| 3933 |
show_progress="full",
|
| 3934 |
show_progress_on=[
|
|
@@ -3941,7 +3946,7 @@ with gr.Blocks(title="HF Contributions") as demo:
|
|
| 3941 |
],
|
| 3942 |
).then(
|
| 3943 |
fn=maybe_reset_community_section,
|
| 3944 |
-
inputs=[community_state, username, selected_year, pr_view_mode, discussion_view_mode],
|
| 3945 |
outputs=community_reset_outputs,
|
| 3946 |
show_progress="hidden",
|
| 3947 |
)
|
|
@@ -3949,38 +3954,38 @@ with gr.Blocks(title="HF Contributions") as demo:
|
|
| 3949 |
for section_key in ("upvotes", "likes", "papers"):
|
| 3950 |
repo_chain = repo_chain.then(
|
| 3951 |
fn=maybe_reset_section_handlers[section_key],
|
| 3952 |
-
inputs=[section_states[section_key], username, selected_year, single_section_components[section_key]["view_mode"]],
|
| 3953 |
outputs=single_section_outputs[f"{section_key}_reset"],
|
| 3954 |
show_progress="hidden",
|
| 3955 |
)
|
| 3956 |
|
| 3957 |
repo_chain = repo_chain.then(
|
| 3958 |
fn=maybe_reset_space_updates_section,
|
| 3959 |
-
inputs=[space_updates_state, username, selected_year, space_updates_view_mode, visibility_mode],
|
| 3960 |
outputs=space_updates_reset_outputs,
|
| 3961 |
show_progress="hidden",
|
| 3962 |
)
|
| 3963 |
|
| 3964 |
visibility_mode.change(
|
| 3965 |
fn=rerender_from_state,
|
| 3966 |
-
inputs=[app_state, visibility_mode],
|
| 3967 |
outputs=repo_render_outputs,
|
| 3968 |
show_progress="hidden",
|
| 3969 |
).then(
|
| 3970 |
fn=maybe_reset_space_updates_section,
|
| 3971 |
-
inputs=[space_updates_state, username, selected_year, space_updates_view_mode, visibility_mode],
|
| 3972 |
outputs=space_updates_reset_outputs,
|
| 3973 |
show_progress="hidden",
|
| 3974 |
)
|
| 3975 |
|
| 3976 |
fetch_community_button.click(
|
| 3977 |
fn=prepare_community_fetch_ui,
|
| 3978 |
-
inputs=[username, selected_year],
|
| 3979 |
outputs=community_context_box,
|
| 3980 |
show_progress="hidden",
|
| 3981 |
).then(
|
| 3982 |
fn=fetch_and_render_community,
|
| 3983 |
-
inputs=[community_state, username, selected_year, pr_view_mode, discussion_view_mode],
|
| 3984 |
outputs=community_fetch_outputs,
|
| 3985 |
show_progress="full",
|
| 3986 |
show_progress_on=[
|
|
@@ -4014,6 +4019,7 @@ with gr.Blocks(title="HF Contributions") as demo:
|
|
| 4014 |
logs_component=components["logs_box"],
|
| 4015 |
username_component=username,
|
| 4016 |
year_component=selected_year,
|
|
|
|
| 4017 |
prepare_fn=prepare_section_handlers[section_key],
|
| 4018 |
fetch_fn=fetch_section_handlers[section_key],
|
| 4019 |
rerender_fn=rerender_section_handlers[section_key],
|
|
@@ -4021,12 +4027,12 @@ with gr.Blocks(title="HF Contributions") as demo:
|
|
| 4021 |
|
| 4022 |
fetch_space_updates_button.click(
|
| 4023 |
fn=prepare_space_updates_fetch_ui,
|
| 4024 |
-
inputs=[username, selected_year],
|
| 4025 |
outputs=space_updates_context_box,
|
| 4026 |
show_progress="hidden",
|
| 4027 |
).then(
|
| 4028 |
fn=fetch_and_render_space_updates_section,
|
| 4029 |
-
inputs=[space_updates_state, username, selected_year, space_updates_view_mode, visibility_mode],
|
| 4030 |
outputs=space_updates_fetch_outputs,
|
| 4031 |
show_progress="full",
|
| 4032 |
show_progress_on=[
|
|
|
|
| 3110 |
logs_component,
|
| 3111 |
username_component,
|
| 3112 |
year_component,
|
| 3113 |
+
profile_component,
|
| 3114 |
prepare_fn,
|
| 3115 |
fetch_fn,
|
| 3116 |
rerender_fn,
|
| 3117 |
):
|
| 3118 |
fetch_button.click(
|
| 3119 |
fn=prepare_fn,
|
| 3120 |
+
inputs=[username_component, year_component, profile_component],
|
| 3121 |
outputs=context_box,
|
| 3122 |
show_progress="hidden",
|
| 3123 |
).then(
|
| 3124 |
fn=fetch_fn,
|
| 3125 |
inputs=[state_component, username_component, year_component, mode_component],
|
| 3126 |
+
outputs=[state_component, context_box, chart_component, logs_component, mode_component, profile_component],
|
| 3127 |
show_progress="full",
|
| 3128 |
show_progress_on=[chart_component, logs_component],
|
| 3129 |
)
|
|
|
|
| 3697 |
}
|
| 3698 |
|
| 3699 |
with gr.Blocks(title="HF Contributions") as demo:
|
| 3700 |
+
|
| 3701 |
+
profile = gr.OAuthProfile()
|
| 3702 |
+
oauth_token = gr.OAuthToken()
|
| 3703 |
+
|
| 3704 |
app_state = gr.State(value=None)
|
| 3705 |
community_state = gr.State(value=None)
|
| 3706 |
space_updates_state = gr.State(value=None)
|
|
|
|
| 3919 |
|
| 3920 |
demo.load(
|
| 3921 |
fn=hydrate_header_on_load,
|
| 3922 |
+
inputs=[username, selected_year, profile],
|
| 3923 |
outputs=[username, context_box, community_context_box]
|
| 3924 |
+ [single_section_components[k]["context_box"] for k in ("upvotes", "likes", "papers")]
|
| 3925 |
+ [space_updates_context_box],
|
|
|
|
| 3928 |
|
| 3929 |
repo_chain = run_button.click(
|
| 3930 |
fn=prepare_repo_fetch_ui,
|
| 3931 |
+
inputs=[username, selected_year, visibility_mode, profile],
|
| 3932 |
outputs=[context_box, visibility_mode],
|
| 3933 |
show_progress="hidden",
|
| 3934 |
).then(
|
| 3935 |
fn=fetch_and_render_repo_only,
|
| 3936 |
+
inputs=[username, selected_year, visibility_mode, profile, oauth_token],
|
| 3937 |
outputs=repo_fetch_outputs,
|
| 3938 |
show_progress="full",
|
| 3939 |
show_progress_on=[
|
|
|
|
| 3946 |
],
|
| 3947 |
).then(
|
| 3948 |
fn=maybe_reset_community_section,
|
| 3949 |
+
inputs=[community_state, username, selected_year, pr_view_mode, discussion_view_mode, profile],
|
| 3950 |
outputs=community_reset_outputs,
|
| 3951 |
show_progress="hidden",
|
| 3952 |
)
|
|
|
|
| 3954 |
for section_key in ("upvotes", "likes", "papers"):
|
| 3955 |
repo_chain = repo_chain.then(
|
| 3956 |
fn=maybe_reset_section_handlers[section_key],
|
| 3957 |
+
inputs=[section_states[section_key], username, selected_year, single_section_components[section_key]["view_mode"], profile],
|
| 3958 |
outputs=single_section_outputs[f"{section_key}_reset"],
|
| 3959 |
show_progress="hidden",
|
| 3960 |
)
|
| 3961 |
|
| 3962 |
repo_chain = repo_chain.then(
|
| 3963 |
fn=maybe_reset_space_updates_section,
|
| 3964 |
+
inputs=[space_updates_state, username, selected_year, space_updates_view_mode, visibility_mode, profile, oauth_token],
|
| 3965 |
outputs=space_updates_reset_outputs,
|
| 3966 |
show_progress="hidden",
|
| 3967 |
)
|
| 3968 |
|
| 3969 |
visibility_mode.change(
|
| 3970 |
fn=rerender_from_state,
|
| 3971 |
+
inputs=[app_state, visibility_mode, profile],
|
| 3972 |
outputs=repo_render_outputs,
|
| 3973 |
show_progress="hidden",
|
| 3974 |
).then(
|
| 3975 |
fn=maybe_reset_space_updates_section,
|
| 3976 |
+
inputs=[space_updates_state, username, selected_year, space_updates_view_mode, visibility_mode, profile, oauth_token],
|
| 3977 |
outputs=space_updates_reset_outputs,
|
| 3978 |
show_progress="hidden",
|
| 3979 |
)
|
| 3980 |
|
| 3981 |
fetch_community_button.click(
|
| 3982 |
fn=prepare_community_fetch_ui,
|
| 3983 |
+
inputs=[username, selected_year, profile],
|
| 3984 |
outputs=community_context_box,
|
| 3985 |
show_progress="hidden",
|
| 3986 |
).then(
|
| 3987 |
fn=fetch_and_render_community,
|
| 3988 |
+
inputs=[community_state, username, selected_year, pr_view_mode, discussion_view_mode, profile],
|
| 3989 |
outputs=community_fetch_outputs,
|
| 3990 |
show_progress="full",
|
| 3991 |
show_progress_on=[
|
|
|
|
| 4019 |
logs_component=components["logs_box"],
|
| 4020 |
username_component=username,
|
| 4021 |
year_component=selected_year,
|
| 4022 |
+
profile_component=profile,
|
| 4023 |
prepare_fn=prepare_section_handlers[section_key],
|
| 4024 |
fetch_fn=fetch_section_handlers[section_key],
|
| 4025 |
rerender_fn=rerender_section_handlers[section_key],
|
|
|
|
| 4027 |
|
| 4028 |
fetch_space_updates_button.click(
|
| 4029 |
fn=prepare_space_updates_fetch_ui,
|
| 4030 |
+
inputs=[username, selected_year, profile],
|
| 4031 |
outputs=space_updates_context_box,
|
| 4032 |
show_progress="hidden",
|
| 4033 |
).then(
|
| 4034 |
fn=fetch_and_render_space_updates_section,
|
| 4035 |
+
inputs=[space_updates_state, username, selected_year, space_updates_view_mode, visibility_mode, profile, oauth_token],
|
| 4036 |
outputs=space_updates_fetch_outputs,
|
| 4037 |
show_progress="full",
|
| 4038 |
show_progress_on=[
|