Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
__author__ = 'Dmitry Ustalov'
|
| 16 |
__license__ = 'Apache 2.0'
|
| 17 |
|
| 18 |
-
import
|
| 19 |
|
| 20 |
import gradio as gr
|
| 21 |
import numpy as np
|
|
@@ -27,11 +27,8 @@ from plotly.graph_objects import Figure
|
|
| 27 |
|
| 28 |
def visualize(df_pairwise: pd.DataFrame) -> Figure:
|
| 29 |
fig = px.imshow(df_pairwise, color_continuous_scale='RdBu', text_auto='.2f')
|
| 30 |
-
|
| 31 |
fig.update_layout(xaxis_title='Loser', yaxis_title='Winner', xaxis_side='top')
|
| 32 |
-
|
| 33 |
fig.update_traces(hovertemplate='Winner: %{y}<br>Loser: %{x}<br>Fraction of Wins: %{z}<extra></extra>')
|
| 34 |
-
|
| 35 |
return fig
|
| 36 |
|
| 37 |
|
|
@@ -85,7 +82,7 @@ def aggregate(wins: npt.NDArray[np.int64], ties: npt.NDArray[np.int64],
|
|
| 85 |
return pi
|
| 86 |
|
| 87 |
|
| 88 |
-
def handler(file:
|
| 89 |
if file is None:
|
| 90 |
raise gr.Error('File must be uploaded')
|
| 91 |
|
|
|
|
| 15 |
__author__ = 'Dmitry Ustalov'
|
| 16 |
__license__ = 'Apache 2.0'
|
| 17 |
|
| 18 |
+
from typing import IO, Tuple
|
| 19 |
|
| 20 |
import gradio as gr
|
| 21 |
import numpy as np
|
|
|
|
| 27 |
|
| 28 |
def visualize(df_pairwise: pd.DataFrame) -> Figure:
|
| 29 |
fig = px.imshow(df_pairwise, color_continuous_scale='RdBu', text_auto='.2f')
|
|
|
|
| 30 |
fig.update_layout(xaxis_title='Loser', yaxis_title='Winner', xaxis_side='top')
|
|
|
|
| 31 |
fig.update_traces(hovertemplate='Winner: %{y}<br>Loser: %{x}<br>Fraction of Wins: %{z}<extra></extra>')
|
|
|
|
| 32 |
return fig
|
| 33 |
|
| 34 |
|
|
|
|
| 82 |
return pi
|
| 83 |
|
| 84 |
|
| 85 |
+
def handler(file: IO[bytes], seed: int) -> Tuple[pd.DataFrame, Figure]:
|
| 86 |
if file is None:
|
| 87 |
raise gr.Error('File must be uploaded')
|
| 88 |
|