davanstrien HF Staff commited on
Commit
3f2f31e
·
1 Parent(s): f558c28

Refactor get_name function to use hf_user_name

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -118,8 +118,8 @@ def get_papers(
118
  return results
119
 
120
 
121
- def get_name(profile: gr.OAuthProfile | None) -> str:
122
- return profile.name if profile else ""
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
- placeholder="Daniel van Strien",
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
  )