wseo-test commited on
Commit
c6ad687
1 Parent(s): b214b0b

feat: add twitter button

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -315,7 +315,7 @@ def leaderboard():
315
  commits = api.list_repo_commits(repo.id, repo_type=repo_type)
316
  for author in set(author for commit in commits if START_DATE < commit.created_at < END_DATE for author in commit.authors):
317
  contributions[author].append((repo_type, repo.id, repo.likes))
318
-
319
  leaderboard = []
320
  for user, repo_likes in contributions.items():
321
  repos = []
@@ -381,6 +381,13 @@ with gr.Blocks() as demo:
381
 
382
  For more information about the offline event [check our event-us page](https://event-us.kr/huggingfacekrew/event/72612).
383
  Don't hesitate to share your contributions on Twitter (tag me [@wonhseo](https://twitter.com/wonhseo) and [@huggingface](https://twitter.com/huggingface)) and on LinkedIn.
 
 
 
 
 
 
 
384
  """
385
  )
386
  with gr.Row():
@@ -392,7 +399,15 @@ with gr.Blocks() as demo:
392
  data_run.click(
393
  leaderboard, outputs=repos_data
394
  )
 
 
 
 
 
 
 
395
 
396
  demo.load(leaderboard, outputs=repos_data)
 
397
 
398
  demo.launch(debug=True)
 
315
  commits = api.list_repo_commits(repo.id, repo_type=repo_type)
316
  for author in set(author for commit in commits if START_DATE < commit.created_at < END_DATE for author in commit.authors):
317
  contributions[author].append((repo_type, repo.id, repo.likes))
318
+
319
  leaderboard = []
320
  for user, repo_likes in contributions.items():
321
  repos = []
 
381
 
382
  For more information about the offline event [check our event-us page](https://event-us.kr/huggingfacekrew/event/72612).
383
  Don't hesitate to share your contributions on Twitter (tag me [@wonhseo](https://twitter.com/wonhseo) and [@huggingface](https://twitter.com/huggingface)) and on LinkedIn.
384
+
385
+ <a class="twitter-share-button" data-size="large"
386
+ data-text="I'm participating in the Hugging Face KREW Hackathon 2023: Everyday AI! @wonhseo @huggingface"
387
+ data-url="https://huggingface.co/spaces/pseudolab/2023-Hackathon-Certification"
388
+ data-hashtags="huggingface,krewhackathon2023"
389
+ href="https://twitter.com/intent/tweet">
390
+ Tweet</a>
391
  """
392
  )
393
  with gr.Row():
 
399
  data_run.click(
400
  leaderboard, outputs=repos_data
401
  )
402
+
403
+ scripts = """
404
+ async () => {
405
+ const twitter = await import("https://platform.twitter.com/widgets.js");
406
+ globalThis.twitter = twitter;
407
+ }
408
+ """
409
 
410
  demo.load(leaderboard, outputs=repos_data)
411
+ demo.load(None, None, None, _js=scripts)
412
 
413
  demo.launch(debug=True)