Spaces:
Sleeping
Sleeping
Commit
·
3f2f31e
1
Parent(s):
f558c28
Refactor get_name function to use hf_user_name
Browse files
app.py
CHANGED
@@ -118,8 +118,8 @@ def get_papers(
|
|
118 |
return results
|
119 |
|
120 |
|
121 |
-
def get_name(
|
122 |
-
return
|
123 |
|
124 |
|
125 |
with gr.Blocks() as demo:
|
@@ -136,7 +136,7 @@ with gr.Blocks() as demo:
|
|
136 |
gr.LoginButton(size="sm")
|
137 |
gr.LogoutButton(size="sm")
|
138 |
author_name = gr.Textbox(
|
139 |
-
|
140 |
label="The name you publish under",
|
141 |
interactive=True,
|
142 |
)
|
|
|
118 |
return results
|
119 |
|
120 |
|
121 |
+
def get_name(hf_user_name: Optional[gr.OAuthProfile] = None):
|
122 |
+
return hf_user_name.name if hf_user_name else ""
|
123 |
|
124 |
|
125 |
with gr.Blocks() as demo:
|
|
|
136 |
gr.LoginButton(size="sm")
|
137 |
gr.LogoutButton(size="sm")
|
138 |
author_name = gr.Textbox(
|
139 |
+
value=get_name,
|
140 |
label="The name you publish under",
|
141 |
interactive=True,
|
142 |
)
|