Spaces:
Sleeping
Sleeping
felix
commited on
Commit
·
8fcd96c
1
Parent(s):
6d7a85e
split links by column
Browse files
app.py
CHANGED
|
@@ -48,24 +48,52 @@ hf_llm_diagrams = [img for img in imgs if 'hf_llm_diagram' in os.path.basename(i
|
|
| 48 |
# Getting the remaining images
|
| 49 |
remaining_imgs = [img for img in imgs if 'hf_llm_diagram' not in os.path.basename(img)]
|
| 50 |
|
| 51 |
-
def print_model_list(file_name, st):
|
| 52 |
file_path = file_name[:-4] + '.json'
|
| 53 |
# Read the list from the JSON file
|
| 54 |
with open(file_path, 'r') as file:
|
| 55 |
model_id_list_loaded = json.load(file)
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
st.write("HuggingFace Open LLM leaderboard by Model Size")
|
| 66 |
st.image(hf_llm_diagrams[0],use_column_width="auto")
|
| 67 |
|
| 68 |
-
print_model_list(hf_llm_diagrams[0],st)
|
| 69 |
|
| 70 |
cols = st.columns(2)
|
| 71 |
cols[0].image(hf_llm_diagrams[1],caption="Other or commercially permissive licenses only", use_column_width="auto")
|
|
|
|
| 48 |
# Getting the remaining images
|
| 49 |
remaining_imgs = [img for img in imgs if 'hf_llm_diagram' not in os.path.basename(img)]
|
| 50 |
|
| 51 |
+
def print_model_list(file_name, st, split_into_two=False):
|
| 52 |
file_path = file_name[:-4] + '.json'
|
| 53 |
# Read the list from the JSON file
|
| 54 |
with open(file_path, 'r') as file:
|
| 55 |
model_id_list_loaded = json.load(file)
|
| 56 |
+
midpoint = len(model_id_list_loaded) // 2 + (len(model_id_list_loaded) % 2) # Calculate the midpoint
|
| 57 |
+
|
| 58 |
+
# Split the list into two parts
|
| 59 |
+
left_list = model_id_list_loaded[:midpoint]
|
| 60 |
+
right_list = model_id_list_loaded[midpoint:]
|
| 61 |
+
|
| 62 |
+
# Generate HTML for the left column
|
| 63 |
+
left_html = ""
|
| 64 |
+
for model_id in left_list:
|
| 65 |
+
model_id_trunc = model_id if len(model_id) <= 35 else '...' + model_id[-35:]
|
| 66 |
+
left_html += f'<li><a href="https://huggingface.co/{model_id}">{model_id_trunc}</a></li>'
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
# Generate HTML for the right column
|
| 70 |
+
right_html = ""
|
| 71 |
+
for model_id in right_list:
|
| 72 |
+
model_id_trunc = model_id if len(model_id) <= 35 else '...' + model_id[-35:]
|
| 73 |
+
right_html += f'<li><a href="https://huggingface.co/{model_id}">{model_id_trunc}</a></li>'
|
| 74 |
+
|
| 75 |
+
final_html = ""
|
| 76 |
+
if(split_into_two):
|
| 77 |
+
final_html = "<ul>"
|
| 78 |
+
final_html += left_html
|
| 79 |
+
final_html += "</ul>"
|
| 80 |
+
cols = st.columns(2)
|
| 81 |
+
cols[0].write(final_html, unsafe_allow_html=True)
|
| 82 |
+
final_html = "<ul>"
|
| 83 |
+
final_html += right_html
|
| 84 |
+
final_html += "</ul>"
|
| 85 |
+
cols[1].write(final_html, unsafe_allow_html=True)
|
| 86 |
+
else:
|
| 87 |
+
final_html = "<ul>"
|
| 88 |
+
final_html += left_html
|
| 89 |
+
final_html += right_html
|
| 90 |
+
final_html += "</ul>"
|
| 91 |
+
st.write(final_html, unsafe_allow_html=True)
|
| 92 |
|
| 93 |
st.write("HuggingFace Open LLM leaderboard by Model Size")
|
| 94 |
st.image(hf_llm_diagrams[0],use_column_width="auto")
|
| 95 |
|
| 96 |
+
print_model_list(hf_llm_diagrams[0],st,True)
|
| 97 |
|
| 98 |
cols = st.columns(2)
|
| 99 |
cols[0].image(hf_llm_diagrams[1],caption="Other or commercially permissive licenses only", use_column_width="auto")
|