ksort commited on
Commit
b39062c
1 Parent(s): 5cff698

Update ssh

Browse files
Files changed (3) hide show
  1. app.py +1 -9
  2. serve/gradio_web.py +10 -2
  3. serve/upload.py +2 -1
app.py CHANGED
@@ -4,10 +4,7 @@ from serve.gradio_web import *
4
  from serve.leaderboard import build_leaderboard_tab
5
  from model.model_manager import ModelManager
6
  from pathlib import Path
7
- from serve.constants import SERVER_PORT, ROOT_PATH, ELO_RESULTS_DIR, SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD
8
- from serve.upload import get_random_mscoco_prompt, create_ssh_client
9
- from serve.update_skill import create_ssh_skill_client
10
- from model.matchmaker import create_ssh_matchmaker_client
11
 
12
  def build_combine_demo(models, elo_results_file, leaderboard_table_file):
13
  # gr.themes.Default(),
@@ -53,11 +50,6 @@ def load_elo_results(elo_results_dir):
53
 
54
  return elo_results_file, leaderboard_table_file
55
 
56
- def set_ssh():
57
- create_ssh_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
58
- create_ssh_skill_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
59
- create_ssh_matchmaker_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
60
-
61
  if __name__ == "__main__":
62
  server_port = int(SERVER_PORT)
63
  root_path = ROOT_PATH
 
4
  from serve.leaderboard import build_leaderboard_tab
5
  from model.model_manager import ModelManager
6
  from pathlib import Path
7
+ from serve.constants import SERVER_PORT, ROOT_PATH, ELO_RESULTS_DIR
 
 
 
8
 
9
  def build_combine_demo(models, elo_results_file, leaderboard_table_file):
10
  # gr.themes.Default(),
 
50
 
51
  return elo_results_file, leaderboard_table_file
52
 
 
 
 
 
 
53
  if __name__ == "__main__":
54
  server_port = int(SERVER_PORT)
55
  root_path = ROOT_PATH
serve/gradio_web.py CHANGED
@@ -36,6 +36,14 @@ from .Ksort import (
36
 
37
  from functools import partial
38
  from .upload import get_random_mscoco_prompt
 
 
 
 
 
 
 
 
39
 
40
  def build_side_by_side_ui_anony(models):
41
  notice_markdown = """
@@ -51,7 +59,7 @@ def build_side_by_side_ui_anony(models):
51
  """
52
 
53
  model_list = models.model_ig_list
54
-
55
  state0 = gr.State()
56
  state1 = gr.State()
57
  state2 = gr.State()
@@ -264,7 +272,7 @@ def build_side_by_side_ui_anony(models):
264
  # Top2_btn.click(reset_level, inputs=[Top2_text], outputs=[vote_level])
265
  # Top3_btn.click(reset_level, inputs=[Top3_text], outputs=[vote_level])
266
  # Top4_btn.click(reset_level, inputs=[Top4_text], outputs=[vote_level])
267
- vote_mode = gr.Textbox(value="Best", visible=False, interactive=False)
268
  right_vote_text = gr.Textbox(value="wrong", visible=False, interactive=False)
269
 
270
  textbox.submit(
 
36
 
37
  from functools import partial
38
  from .upload import get_random_mscoco_prompt
39
+ from serve.constants import SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD
40
+ from serve.upload import get_random_mscoco_prompt, create_ssh_client
41
+ from serve.update_skill import create_ssh_skill_client
42
+ from model.matchmaker import create_ssh_matchmaker_client
43
+ def set_ssh():
44
+ create_ssh_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
45
+ create_ssh_skill_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
46
+ create_ssh_matchmaker_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
47
 
48
  def build_side_by_side_ui_anony(models):
49
  notice_markdown = """
 
59
  """
60
 
61
  model_list = models.model_ig_list
62
+ set_ssh()
63
  state0 = gr.State()
64
  state1 = gr.State()
65
  state2 = gr.State()
 
272
  # Top2_btn.click(reset_level, inputs=[Top2_text], outputs=[vote_level])
273
  # Top3_btn.click(reset_level, inputs=[Top3_text], outputs=[vote_level])
274
  # Top4_btn.click(reset_level, inputs=[Top4_text], outputs=[vote_level])
275
+ vote_mode = gr.Textbox(value="Rank", visible=False, interactive=False)
276
  right_vote_text = gr.Textbox(value="wrong", visible=False, interactive=False)
277
 
278
  textbox.submit(
serve/upload.py CHANGED
@@ -69,4 +69,5 @@ def upload_ssh_all(states, output_dir, data, data_path):
69
  json_data = json.dumps(data, indent=4)
70
  with io.BytesIO(json_data.encode('utf-8')) as json_byte_stream:
71
  sftp_client.putfo(json_byte_stream, data_path)
72
- print(f"Successfully uploaded JSON data to {data_path}")
 
 
69
  json_data = json.dumps(data, indent=4)
70
  with io.BytesIO(json_data.encode('utf-8')) as json_byte_stream:
71
  sftp_client.putfo(json_byte_stream, data_path)
72
+ print(f"Successfully uploaded JSON data to {data_path}")
73
+ create_ssh_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)