Weyaxi commited on
Commit
da8e06f
·
verified ·
1 Parent(s): 5b92566

better display

Browse files
Files changed (1) hide show
  1. app.py +36 -4
app.py CHANGED
@@ -70,10 +70,42 @@ def return_operation_details(from_model, to_model):
70
  return liste
71
 
72
  def commit(liste_requests, liste_results, liste_details, details_path, from_model, to_model):
73
- request_commit = (create_commit(repo_id="open-llm-leaderboard/requests", operations=liste_requests, commit_message=f"Renaming Model {from_model} to {to_model}", repo_type="dataset", create_pr=True).__dict__['pr_url'])
74
- result_commit = (create_commit(repo_id="open-llm-leaderboard/results", operations=liste_results, commit_message=f"Renaming Model {from_model} to {to_model}", repo_type="dataset", create_pr=True).__dict__['pr_url'])
75
- details_commit = (create_commit(repo_id="/".join(details_path.split("/")[1:]), operations=liste_details, commit_message=f"Renaming Model {from_model} to {to_model}", repo_type="dataset", create_pr=True).__dict__['pr_url'])
76
- return f"{request_commit}\n{result_commit}\n{details_commit}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
 
79
  def commit_gradio(from_model, to_model, hf_token):
 
70
  return liste
71
 
72
  def commit(liste_requests, liste_results, liste_details, details_path, from_model, to_model):
73
+ common_for_commits = {"commit_message": f"Renaming Model {from_model} to {to_model}", "repo_type": "dataset", "create_pr": True}
74
+
75
+ request_commit = (create_commit(repo_id="open-llm-leaderboard/requests", operations=liste_requests, **common_for_commits))
76
+ result_commit = (create_commit(repo_id="open-llm-leaderboard/results", operations=liste_results, **common_for_commits))
77
+ details_commit = (create_commit(repo_id="/".join(details_path.split("/")[1:]), operations=liste_details, **common_for_commits))
78
+
79
+ all_commits = [request_commit, result_commit, details_commit]
80
+ all_repo_ids = ["open-llm-leaderboard/requests", "open-llm-leaderboard/results", "/".join(details_path.split("/")[1:])]
81
+
82
+ # Edit comment descriptions
83
+
84
+ content = f"{request_commit.pr_url}\n{result_commit.pr_url}\n{details_commit.pr_url}"
85
+
86
+ content = f"""This is a pull request aiming to rename the model {from_model} to {to_model}. All related pull requests to rename this model can be found below.
87
+ # Requests
88
+
89
+ {request_commit.pr_url}
90
+
91
+ # Results
92
+
93
+ {result_commit.pr_url}
94
+
95
+ # Details
96
+
97
+ {details_commit.pr_url}
98
+ """
99
+
100
+ for i, common_repo_id in enumerate(all_repo_ids):
101
+ commit = all_commits[i]
102
+ common_for_edits = {"repo_id": common_repo_id, "discussion_num": commit.pr_num, "repo_type": "dataset"}
103
+
104
+ comment_id = get_discussion_details(**common_for_edits).events[0].id
105
+ edit_discussion_comment(**common_for_edits, comment_id=comment_id, new_content=content)
106
+
107
+
108
+ return f"{request_commit.pr_url}\n{result_commit.pr_url}\n{details_commit.pr_url}"
109
 
110
 
111
  def commit_gradio(from_model, to_model, hf_token):