Accept an issue number too

#1
by YiYiXu HF Staff - opened
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -68,8 +68,8 @@ def _require_validation_record(github_username: str, pr_number: str) -> dict[str
68
  record = _VALIDATION_INDEX.get(key)
69
  if record is None:
70
  raise gr.Error(
71
- "No matching submission was found. Make sure the PR was accepted and "
72
- "your GitHub handle is correct."
73
  )
74
  return record
75
 
@@ -144,7 +144,7 @@ def issue_certificate(
144
  profile: gr.OAuthProfile | None,
145
  ) -> str:
146
  if not github_username.strip() or not pr_number:
147
- raise gr.Error("Both GitHub username and PR number are required.")
148
 
149
  if not name.strip():
150
  raise gr.Error("Please provide the full name for the certificate.")
@@ -183,7 +183,7 @@ with gr.Blocks(title="MVP Certificate Generator") as demo:
183
  """
184
  # MVP Certificate Generator
185
 
186
- Sign in with your Hugging Face account, verify your merged PR, and mint a certificate.
187
  """
188
  )
189
 
@@ -195,7 +195,7 @@ with gr.Blocks(title="MVP Certificate Generator") as demo:
195
  placeholder="huggingface",
196
  autofocus=True,
197
  )
198
- pr_number_input = gr.Textbox(label="PR Number", placeholder="42")
199
  name_input = gr.Textbox(label="Name on Certificate", placeholder="Jane Doe")
200
 
201
  generate_button = gr.Button("Generate certificate", variant="primary")
 
68
  record = _VALIDATION_INDEX.get(key)
69
  if record is None:
70
  raise gr.Error(
71
+ "No matching entry was found. Make sure a maintainer has recognized your PR or issue "
72
+ "comment, and that your GitHub handle is correct."
73
  )
74
  return record
75
 
 
144
  profile: gr.OAuthProfile | None,
145
  ) -> str:
146
  if not github_username.strip() or not pr_number:
147
+ raise gr.Error("Both GitHub username and PR or issue number are required.")
148
 
149
  if not name.strip():
150
  raise gr.Error("Please provide the full name for the certificate.")
 
183
  """
184
  # MVP Certificate Generator
185
 
186
+ Sign in with your Hugging Face account, enter the PR or issue you were recognized for, and mint a certificate.
187
  """
188
  )
189
 
 
195
  placeholder="huggingface",
196
  autofocus=True,
197
  )
198
+ pr_number_input = gr.Textbox(label="PR or issue number", placeholder="42")
199
  name_input = gr.Textbox(label="Name on Certificate", placeholder="Jane Doe")
200
 
201
  generate_button = gr.Button("Generate certificate", variant="primary")