eduagarcia commited on
Commit
531fabf
1 Parent(s): 76ebbdf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -3,12 +3,23 @@ import ast
3
  import argparse
4
  import glob
5
  import pickle
 
6
  from datetime import datetime
7
 
 
8
  import gradio as gr
9
  import numpy as np
10
  import pandas as pd
11
 
 
 
 
 
 
 
 
 
 
12
 
13
  original_notebook_url = "https://colab.research.google.com/drive/1KdwokPjirkTmpO_P1WByFNFiqxWQquwH#scrollTo=o_CpbkGEbhrK"
14
  notebook_url = "https://colab.research.google.com/drive/11eWOT3VAAWRRrs1CSsAg84hIaJvH2ThK?usp=sharing"
@@ -514,4 +525,5 @@ with gr.Blocks(
514
  )
515
 
516
  if __name__ == "__main__":
 
517
  demo.launch()
 
3
  import argparse
4
  import glob
5
  import pickle
6
+ import threading
7
  from datetime import datetime
8
 
9
+ from huggingface_hub import HfApi
10
  import gradio as gr
11
  import numpy as np
12
  import pandas as pd
13
 
14
+ api = HfApi()
15
+
16
+ def refresh(how_much=3600): # default to 1 hour
17
+ time.sleep(how_much)
18
+ try:
19
+ api.restart_space(repo_id="meval/multilingual-chatbot-arena-leaderboard")
20
+ except Exception as e:
21
+ print(f"Error while scraping leaderboard, trying again... {e}")
22
+ refresh(600) # 10 minutes if any error happens
23
 
24
  original_notebook_url = "https://colab.research.google.com/drive/1KdwokPjirkTmpO_P1WByFNFiqxWQquwH#scrollTo=o_CpbkGEbhrK"
25
  notebook_url = "https://colab.research.google.com/drive/11eWOT3VAAWRRrs1CSsAg84hIaJvH2ThK?usp=sharing"
 
525
  )
526
 
527
  if __name__ == "__main__":
528
+ threading.Thread(target=run_pr_worker).start()
529
  demo.launch()