Weyaxi commited on
Commit
a2723b3
1 Parent(s): a49fcac

restrat every 1 hour

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -11,13 +11,13 @@ import time
11
  import requests
12
  import pandas as pd
13
  from pytablewriter import MarkdownTableWriter
 
14
  import gradio as gr
15
-
16
  from gradio_space_ci import enable_space_ci
17
 
18
  enable_space_ci()
19
 
20
-
21
 
22
  api = HfApi()
23
  fs = HfFileSystem()
@@ -27,6 +27,11 @@ finished_models = get_datas(data)
27
  df = pd.DataFrame(finished_models)
28
 
29
 
 
 
 
 
 
30
  def search(df, value):
31
  result_df = df[df["Model"] == value]
32
  return result_df.iloc[0].to_dict() if not result_df.empty else None
@@ -237,4 +242,5 @@ with gr.Blocks() as demo:
237
  submit_btn = gr.Button("Submit", variant="primary")
238
  submit_btn.click(commit, model_id, output)
239
 
 
240
  demo.launch()
 
11
  import requests
12
  import pandas as pd
13
  from pytablewriter import MarkdownTableWriter
14
+ import threading
15
  import gradio as gr
 
16
  from gradio_space_ci import enable_space_ci
17
 
18
  enable_space_ci()
19
 
20
+ HF_TOKEN = os.getenv('HF_TOKEN')
21
 
22
  api = HfApi()
23
  fs = HfFileSystem()
 
27
  df = pd.DataFrame(finished_models)
28
 
29
 
30
+ def restart_space():
31
+ time.sleep(3600)
32
+ api.restart_space(repo_id="Weyaxi/leaderboard-results-to-modelcard", token=HF_TOKEN)
33
+
34
+
35
  def search(df, value):
36
  result_df = df[df["Model"] == value]
37
  return result_df.iloc[0].to_dict() if not result_df.empty else None
 
242
  submit_btn = gr.Button("Submit", variant="primary")
243
  submit_btn.click(commit, model_id, output)
244
 
245
+ threading.Thread(target=restart_space).start()
246
  demo.launch()