AlexK-PL commited on
Commit
c628e3e
·
1 Parent(s): 92be68f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -20
app.py CHANGED
@@ -48,28 +48,12 @@ def plot_spec_align(mel, align):
48
  fig_mel = plt.figure()
49
  ax_mel = fig_mel.add_subplot(111)
50
  ax_mel.imshow(mel)
51
- ax_mel.set_title('Mel-Scale Spectrogram', fontsize=20)
52
 
53
  fig_align = plt.figure()
54
  ax_align = fig_align.add_subplot(111)
55
  ax_align.imshow(align)
56
- ax_align.set_title('Alignment', fontsize=20)
57
-
58
- '''
59
- grid_spec = gridspec.GridSpec(1, 1)
60
- ax = plt.subplot(grid_spec[0])
61
- plt.imshow(mel)
62
- plt.axis('off')
63
- ax.set_title('Mel-Scale Spectrogram', fontsize=20)
64
-
65
- ax = plt.subplot(grid_spec[1])
66
- plt.imshow(align)
67
- plt.axis('off')
68
- ax.set_title('Alignment', fontsize=20)
69
-
70
- plt.imshow(legend, interpolation='nearest')
71
- plt.grid('off')
72
- '''
73
 
74
  return fig_mel, fig_align
75
 
@@ -90,8 +74,9 @@ def synthesize(text, gst_1, gst_2, gst_3):
90
  audio_numpy = audio.data.cpu().detach().numpy()
91
 
92
  # prepare plot for the output:
93
- mel_outputs_postnet = mel_outputs_postnet.squeeze().detach().numpy()
94
- alignments = alignments.squeeze().detach().numpy()
 
95
  fig_mel, fig_align = plot_spec_align(mel_outputs_postnet, alignments)
96
 
97
  return (22050, audio_numpy), fig_mel, fig_align
 
48
  fig_mel = plt.figure()
49
  ax_mel = fig_mel.add_subplot(111)
50
  ax_mel.imshow(mel)
51
+ ax_mel.set_title('Mel-Scale Spectrogram', fontsize=12)
52
 
53
  fig_align = plt.figure()
54
  ax_align = fig_align.add_subplot(111)
55
  ax_align.imshow(align)
56
+ ax_align.set_title('Alignment', fontsize=12)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  return fig_mel, fig_align
59
 
 
74
  audio_numpy = audio.data.cpu().detach().numpy()
75
 
76
  # prepare plot for the output:
77
+ mel_outputs_postnet = torch.flip(mel_outputs_postnet.squeeze(), [0])
78
+ mel_outputs_postnet = mel_outputs_postnet.detach().numpy()
79
+ alignments = alignments.squeeze().T.detach().numpy()
80
  fig_mel, fig_align = plot_spec_align(mel_outputs_postnet, alignments)
81
 
82
  return (22050, audio_numpy), fig_mel, fig_align