Spaces:
Sleeping
Sleeping
Commit
·
320d802
1
Parent(s):
1f24a5f
Add get_name function to retrieve profile name
Browse files
app.py
CHANGED
|
@@ -118,6 +118,10 @@ def get_papers(
|
|
| 118 |
return results
|
| 119 |
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
with gr.Blocks() as demo:
|
| 122 |
gr.HTML(
|
| 123 |
"<h1 style='text-align:center;'> 📃 Hugging Face Paper Claimer 📃 </h1>"
|
|
@@ -132,10 +136,11 @@ with gr.Blocks() as demo:
|
|
| 132 |
gr.LoginButton(size="sm")
|
| 133 |
gr.LogoutButton(size="sm")
|
| 134 |
author_name = gr.Textbox(
|
|
|
|
| 135 |
placeholder="Daniel van Strien",
|
| 136 |
label="The name you publish under",
|
| 137 |
interactive=True,
|
| 138 |
-
)
|
| 139 |
positive_arxiv_ids = gr.Textbox(
|
| 140 |
placeholder="1910.01108",
|
| 141 |
label="ArXiv ID for a paper for which you are an author",
|
|
|
|
| 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:
|
| 126 |
gr.HTML(
|
| 127 |
"<h1 style='text-align:center;'> 📃 Hugging Face Paper Claimer 📃 </h1>"
|
|
|
|
| 136 |
gr.LoginButton(size="sm")
|
| 137 |
gr.LogoutButton(size="sm")
|
| 138 |
author_name = gr.Textbox(
|
| 139 |
+
value=get_name(),
|
| 140 |
placeholder="Daniel van Strien",
|
| 141 |
label="The name you publish under",
|
| 142 |
interactive=True,
|
| 143 |
+
).attach_load_event(get_name, None)
|
| 144 |
positive_arxiv_ids = gr.Textbox(
|
| 145 |
placeholder="1910.01108",
|
| 146 |
label="ArXiv ID for a paper for which you are an author",
|