Spaces:
Running
on
Zero
Running
on
Zero
Update ssh
Browse files- serve/leaderboard.py +2 -1
- serve/upload.py +21 -11
- serve/utils.py +1 -16
- sum_prompt.txt +0 -0
serve/leaderboard.py
CHANGED
@@ -134,7 +134,8 @@ def make_arena_leaderboard_md(elo_results):
|
|
134 |
total_models = len(arena_df)
|
135 |
|
136 |
leaderboard_md = f"""
|
137 |
-
Total #models: **{total_models}**(anonymous). Total #votes: **{total_votes}
|
|
|
138 |
"""
|
139 |
|
140 |
return leaderboard_md
|
|
|
134 |
total_models = len(arena_df)
|
135 |
|
136 |
leaderboard_md = f"""
|
137 |
+
Total #models: **{total_models}**(anonymous). Total #votes: **{total_votes}** (Equivalent to **{total_votes*6}** votes for one-on-one games).
|
138 |
+
Last updated: {last_updated}.
|
139 |
"""
|
140 |
|
141 |
return leaderboard_md
|
serve/upload.py
CHANGED
@@ -41,19 +41,28 @@ def get_image_from_url(image_url):
|
|
41 |
response.raise_for_status() # success
|
42 |
return Image.open(io.BytesIO(response.content))
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
def get_random_mscoco_prompt():
|
45 |
-
global sftp_client
|
46 |
-
if not is_connected():
|
47 |
-
create_ssh_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
|
48 |
-
num = random.randint(0, 2999)
|
49 |
-
file = "{}.txt".format(num)
|
50 |
|
51 |
-
|
52 |
-
with
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
return
|
57 |
|
58 |
|
59 |
def create_remote_directory(remote_directory):
|
@@ -85,6 +94,7 @@ def upload_ssh_all(states, output_dir, data, data_path):
|
|
85 |
print("get url image")
|
86 |
image_list[i] = get_image_from_url(image_list[i])
|
87 |
with io.BytesIO() as image_byte_stream:
|
|
|
88 |
image_list[i].save(image_byte_stream, format='JPEG')
|
89 |
image_byte_stream.seek(0)
|
90 |
sftp.putfo(image_byte_stream, output_file_list[i])
|
|
|
41 |
response.raise_for_status() # success
|
42 |
return Image.open(io.BytesIO(response.content))
|
43 |
|
44 |
+
# def get_random_mscoco_prompt():
|
45 |
+
# global sftp_client
|
46 |
+
# if not is_connected():
|
47 |
+
# create_ssh_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD)
|
48 |
+
# num = random.randint(0, 2999)
|
49 |
+
# file = "{}.txt".format(num)
|
50 |
+
|
51 |
+
# remote_file_path = os.path.join(SSH_MSCOCO, file)
|
52 |
+
# with sftp_client.file(remote_file_path, 'r') as f:
|
53 |
+
# content = f.read().decode('utf-8')
|
54 |
+
# print(f"Content of {file}:")
|
55 |
+
# print("\n")
|
56 |
+
# return content
|
57 |
+
|
58 |
def get_random_mscoco_prompt():
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
file_path = './sum_prompt.txt'
|
61 |
+
with open(file_path, 'r') as file:
|
62 |
+
lines = file.readlines()
|
63 |
+
|
64 |
+
random_line = random.choice(lines).strip()
|
65 |
+
return random_line
|
66 |
|
67 |
|
68 |
def create_remote_directory(remote_directory):
|
|
|
94 |
print("get url image")
|
95 |
image_list[i] = get_image_from_url(image_list[i])
|
96 |
with io.BytesIO() as image_byte_stream:
|
97 |
+
image_list[i] = image_list[i].resize((512, 512), Image.ANTIALIAS)
|
98 |
image_list[i].save(image_byte_stream, format='JPEG')
|
99 |
image_byte_stream.seek(0)
|
100 |
sftp.putfo(image_byte_stream, output_file_list[i])
|
serve/utils.py
CHANGED
@@ -19,22 +19,7 @@ no_change_btn = gr.update(value="No Change", interactive=True, visible=True)
|
|
19 |
def build_about():
|
20 |
about_markdown = f"""
|
21 |
# About Us
|
22 |
-
This is a project from TIGER Lab at University of Waterloo.
|
23 |
|
24 |
-
## Contributors:
|
25 |
-
[Tianle Li](https://scholar.google.com/citations?user=g213g7YAAAAJ&hl=en), [Dongfu Jiang](https://jdf-prog.github.io/), [Yuansheng Ni](https://yuanshengni.github.io/), [Max Ku](https://kuwingfung.github.io/), [Shizhuo Sun](), [Richard Fan](https://www.linkedin.com/in/richard-fan2020/).
|
26 |
-
|
27 |
-
## Contact:
|
28 |
-
Email: [email protected] (Tianle Li)
|
29 |
-
|
30 |
-
## Advisors
|
31 |
-
[Wenhu Chen](https://wenhuchen.github.io/)
|
32 |
-
|
33 |
-
## Sponsorship
|
34 |
-
We are keep looking for sponsorship to support the arena project for the long term. Please contact us if you are interested in supporting this project.
|
35 |
-
|
36 |
-
## Acknowledgment
|
37 |
-
Our codebase is built upon <a href="https://github.com/lm-sys/FastChat" target="_blank">FastChat</a>, <a href="https://github.com/TIGER-AI-Lab/ImagenHub" target="_blank">ImagenHub</a> and <a href="https://github.com/TIGER-AI-Lab/VideoGenHub" target="_blank">VideoGenHub</a>.
|
38 |
"""
|
39 |
|
40 |
gr.Markdown(about_markdown, elem_id="about_markdown")
|
@@ -43,7 +28,7 @@ Our codebase is built upon <a href="https://github.com/lm-sys/FastChat" target="
|
|
43 |
acknowledgment_md = """
|
44 |
### Acknowledgment
|
45 |
<div class="image-container">
|
46 |
-
<p> Our codebase is built upon <a href="https://github.com/lm-sys/FastChat" target="_blank">FastChat</a>, <a href="https://github.com/TIGER-AI-Lab/ImagenHub" target="_blank">ImagenHub</a
|
47 |
</div>
|
48 |
"""
|
49 |
block_css = """
|
|
|
19 |
def build_about():
|
20 |
about_markdown = f"""
|
21 |
# About Us
|
|
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
"""
|
24 |
|
25 |
gr.Markdown(about_markdown, elem_id="about_markdown")
|
|
|
28 |
acknowledgment_md = """
|
29 |
### Acknowledgment
|
30 |
<div class="image-container">
|
31 |
+
<p> Our codebase is built upon <a href="https://github.com/lm-sys/FastChat" target="_blank">FastChat</a>, <a href="https://github.com/TIGER-AI-Lab/ImagenHub" target="_blank">ImagenHub</a>.</p>
|
32 |
</div>
|
33 |
"""
|
34 |
block_css = """
|
sum_prompt.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|