wi-lab commited on
Commit
d854d43
·
verified ·
1 Parent(s): c7df97b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -39,6 +39,8 @@ def _matrix_payload(np_mat: np.ndarray, labels: Optional[List[str]] = None):
39
  Return a safe gr.update payload for a Dataframe (headers must match col_count).
40
  """
41
  df = pd.DataFrame(np_mat)
 
 
42
  if labels is not None and len(labels) == df.shape[0]:
43
  df.index = labels
44
  if labels is not None and len(labels) == df.shape[1]:
@@ -59,7 +61,7 @@ def _plot_heatmap(D: np.ndarray, labels: Optional[List[str]] = None) -> np.ndarr
59
  fig, ax = plt.subplots(figsize=(6, 5), dpi=160, facecolor='#1e1e1e')
60
  ax.set_facecolor('#1e1e1e')
61
 
62
- im = ax.imshow(D, cmap="viridis")
63
  cbar = plt.colorbar(im, ax=ax, fraction=0.046, pad=0.04)
64
  cbar.ax.tick_params(colors='white') # Light colorbar labels
65
 
 
39
  Return a safe gr.update payload for a Dataframe (headers must match col_count).
40
  """
41
  df = pd.DataFrame(np_mat)
42
+ # Round to 3 decimal places
43
+ df = df.round(3)
44
  if labels is not None and len(labels) == df.shape[0]:
45
  df.index = labels
46
  if labels is not None and len(labels) == df.shape[1]:
 
61
  fig, ax = plt.subplots(figsize=(6, 5), dpi=160, facecolor='#1e1e1e')
62
  ax.set_facecolor('#1e1e1e')
63
 
64
+ im = ax.imshow(D, cmap="magma")
65
  cbar = plt.colorbar(im, ax=ax, fraction=0.046, pad=0.04)
66
  cbar.ax.tick_params(colors='white') # Light colorbar labels
67