TroglodyteDerivations commited on
Commit
d0dbf99
1 Parent(s): c5c0498

Updated lines 166-177

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -168,12 +168,15 @@ def plot_trellis_with_path(trellis, path):
168
  trellis_with_path = trellis.clone()
169
  for _, p in enumerate(path):
170
  trellis_with_path[p.time_index, p.token_index] = float("nan")
171
- plt.imshow(trellis_with_path.T, origin="lower")
172
- plt.title("The path found by backtracking")
173
- plt.tight_layout()
174
- return plt
 
 
 
175
 
176
- st.pyplot(plt)
177
 
178
  # Part J: Merge Repeats | Segments
179
  # Merge the labels
 
168
  trellis_with_path = trellis.clone()
169
  for _, p in enumerate(path):
170
  trellis_with_path[p.time_index, p.token_index] = float("nan")
171
+ fig, ax = plt.subplots()
172
+ ax.imshow(trellis_with_path.T, origin="lower")
173
+ ax.set_title("The path found by backtracking")
174
+ ax.set_xlabel("Time")
175
+ ax.set_ylabel("Labels")
176
+ fig.tight_layout()
177
+ return fig
178
 
179
+ st.pyplot(fig)
180
 
181
  # Part J: Merge Repeats | Segments
182
  # Merge the labels