Update app.py
Browse files
app.py
CHANGED
@@ -117,25 +117,26 @@ def handler(file: typing.IO[bytes], seed: int) -> pd.DataFrame:
|
|
117 |
return df_result
|
118 |
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
),
|
128 |
-
|
129 |
-
|
130 |
-
precision=0
|
131 |
-
)
|
132 |
-
],
|
133 |
-
outputs=gr.Dataframe(
|
134 |
-
headers=['item', 'score', 'rank'],
|
135 |
-
label='Ranking'
|
136 |
-
),
|
137 |
-
title='Pair2Rank: Turn Your Side-by-Side Comparisons into Ranking!',
|
138 |
-
description='''
|
139 |
This easy-to-use tool transforms pairwise comparisons (aka side-by-side) to a meaningful ranking of items.
|
140 |
|
141 |
As an input, it expects a comma-separated (CSV) file with a header containing the following columns:
|
@@ -148,12 +149,16 @@ Possible values for `winner` are `left`, `right`, or `tie`.
|
|
148 |
The provided example might be a good starting point.
|
149 |
|
150 |
As the output, this tool provides a table with items, their estimated scores, and ranks.
|
151 |
-
|
152 |
-
|
153 |
-
This tool
|
154 |
[Efficient Computation of Rankings from Pairwise Comparisons](https://www.jmlr.org/papers/v24/22-1086.html).
|
155 |
-
|
156 |
-
|
157 |
-
)
|
|
|
|
|
|
|
158 |
|
159 |
-
|
|
|
|
117 |
return df_result
|
118 |
|
119 |
|
120 |
+
def main() -> None:
|
121 |
+
iface = gr.Interface(
|
122 |
+
fn=handler,
|
123 |
+
inputs=[
|
124 |
+
gr.File(
|
125 |
+
value='example.csv',
|
126 |
+
file_types=['.tsv', '.csv'],
|
127 |
+
label='Comparisons'
|
128 |
+
),
|
129 |
+
gr.Number(
|
130 |
+
label='Seed',
|
131 |
+
precision=0
|
132 |
+
)
|
133 |
+
],
|
134 |
+
outputs=gr.Dataframe(
|
135 |
+
headers=['item', 'score', 'rank'],
|
136 |
+
label='Ranking'
|
137 |
),
|
138 |
+
title='Pair2Rank: Turn Your Side-by-Side Comparisons into Ranking!',
|
139 |
+
description='''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
This easy-to-use tool transforms pairwise comparisons (aka side-by-side) to a meaningful ranking of items.
|
141 |
|
142 |
As an input, it expects a comma-separated (CSV) file with a header containing the following columns:
|
|
|
149 |
The provided example might be a good starting point.
|
150 |
|
151 |
As the output, this tool provides a table with items, their estimated scores, and ranks.
|
152 |
+
''',
|
153 |
+
article='''
|
154 |
+
This tool attempts to implement the tie-aware ranking aggregation algorithm as described in
|
155 |
[Efficient Computation of Rankings from Pairwise Comparisons](https://www.jmlr.org/papers/v24/22-1086.html).
|
156 |
+
''',
|
157 |
+
allow_flagging='never'
|
158 |
+
)
|
159 |
+
|
160 |
+
iface.launch()
|
161 |
+
|
162 |
|
163 |
+
if __name__ == '__main__':
|
164 |
+
main()
|