davanstrien HF Staff commited on
Commit
1f24a5f
·
1 Parent(s): 16fdb1b

Add check for logged in user before accessing

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -81,6 +81,8 @@ def groupby_hf_user_papers(papers, hf_user_name):
81
  def get_papers(
82
  author_name: str, positive_arxiv_ids: str, hf_user_name: Optional[gr.OAuthProfile]
83
  ):
 
 
84
  hf_user_name = hf_user_name.preferred_username
85
  positive_arxiv_ids = positive_arxiv_ids.split(",")
86
  potential_authors = query_author(author_name)
 
81
  def get_papers(
82
  author_name: str, positive_arxiv_ids: str, hf_user_name: Optional[gr.OAuthProfile]
83
  ):
84
+ if not hf_user_name:
85
+ raise gr.Error("You must be logged in to use this Space")
86
  hf_user_name = hf_user_name.preferred_username
87
  positive_arxiv_ids = positive_arxiv_ids.split(",")
88
  potential_authors = query_author(author_name)