patrickvonplaten commited on
Commit
0483c7f
1 Parent(s): a1bb07d
Files changed (2) hide show
  1. __pycache__/app.cpython-310.pyc +0 -0
  2. app.py +23 -4
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
app.py CHANGED
@@ -49,6 +49,19 @@ def load_submissions():
49
 
50
  return main_dict, challenges, categories
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  def get_dataframe_all():
53
  main, challenges, categories = load_submissions()
54
  main_frame = pd.DataFrame([main])
@@ -64,6 +77,11 @@ def get_dataframe_all():
64
  categories_frame = categories_frame.reset_index().rename(columns={'index': 'Category'})
65
  challenges_frame = challenges_frame.reset_index().rename(columns={'index': 'Challenge'})
66
 
 
 
 
 
 
67
  return main_frame, challenges_frame, categories_frame
68
 
69
  TITLE = "# Open Parti Prompts Leaderboard"
@@ -76,15 +94,16 @@ EXPLANATION = """\n\n
76
 
77
  In the [Community Parti Prompts](https://huggingface.co/spaces/OpenGenAI/open-parti-prompts), community members select for every prompt
78
  of [Parti Prompts](https://huggingface.co/datasets/nateraw/parti-prompts) which open-source image generation model has generated the best image.
79
- The community's answers are then stored and used in this space to give a human evaluation of the different models.
 
80
  Currently the leaderboard includes the following models:
81
  - [sd-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5)
82
  - [sd-v2-1](https://huggingface.co/stabilityai/stable-diffusion-2-1)
83
  - [if-v1-0](https://huggingface.co/DeepFloyd/IF-I-XL-v1.0)
84
- - [karlo](https://huggingface.co/kakaobrain/karlo-v1-alpha)
85
 
86
  In the following you can see three result tables. The first shows you the overall preferences across all prompts. The second and third tables
87
- show you a breakdown analysis per category and level of difficulty ("challenge") as defined by [Parti Prompts](https://huggingface.co/datasets/nateraw/parti-prompts).
88
  """
89
 
90
  GALLERY_COLUMN_NUM = len(SUBMISSIONS)
@@ -101,7 +120,7 @@ with gr.Blocks() as demo:
101
  headers = list(SUBMISSIONS.keys())
102
  datatype = "str"
103
 
104
- main_df, category_df, challenge_df = get_dataframe_all()
105
 
106
  with gr.Column():
107
  gr.Markdown("# Open Parti Prompts")
 
49
 
50
  return main_dict, challenges, categories
51
 
52
+ def sort_by_highest_percentage(df):
53
+ # Convert percentage values to numeric format
54
+ for column in df.columns.to_list():
55
+ df[column] = pd.to_numeric(df[column].str.rstrip('%'))
56
+
57
+ # Sort DataFrame by highest percentage first
58
+ df = df.sort_values(by=column, ascending=False)
59
+
60
+ # Convert back to percentage string format
61
+ df[column] = df[column].astype(str) + '%'
62
+
63
+ return df
64
+
65
  def get_dataframe_all():
66
  main, challenges, categories = load_submissions()
67
  main_frame = pd.DataFrame([main])
 
77
  categories_frame = categories_frame.reset_index().rename(columns={'index': 'Category'})
78
  challenges_frame = challenges_frame.reset_index().rename(columns={'index': 'Challenge'})
79
 
80
+ main_frame = sort_by_highest_percentage(main_frame)
81
+
82
+ categories_frame = categories_frame.reindex(columns=main_frame.columns.to_list())
83
+ challenges_frame = challenges_frame.reindex(columns=main_frame.columns.to_list())
84
+
85
  return main_frame, challenges_frame, categories_frame
86
 
87
  TITLE = "# Open Parti Prompts Leaderboard"
 
94
 
95
  In the [Community Parti Prompts](https://huggingface.co/spaces/OpenGenAI/open-parti-prompts), community members select for every prompt
96
  of [Parti Prompts](https://huggingface.co/datasets/nateraw/parti-prompts) which open-source image generation model has generated the best image.
97
+ The community's answers are then stored and used in this space to give a human evaluation of the different models. \n\n
98
+
99
  Currently the leaderboard includes the following models:
100
  - [sd-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5)
101
  - [sd-v2-1](https://huggingface.co/stabilityai/stable-diffusion-2-1)
102
  - [if-v1-0](https://huggingface.co/DeepFloyd/IF-I-XL-v1.0)
103
+ - [karlo](https://huggingface.co/kakaobrain/karlo-v1-alpha) \n\n
104
 
105
  In the following you can see three result tables. The first shows you the overall preferences across all prompts. The second and third tables
106
+ show you a breakdown analysis per category and per type of challenge as defined by [Parti Prompts](https://huggingface.co/datasets/nateraw/parti-prompts).
107
  """
108
 
109
  GALLERY_COLUMN_NUM = len(SUBMISSIONS)
 
120
  headers = list(SUBMISSIONS.keys())
121
  datatype = "str"
122
 
123
+ main_df, challenge_df, category_df = get_dataframe_all()
124
 
125
  with gr.Column():
126
  gr.Markdown("# Open Parti Prompts")