guyyariv commited on
Commit
e5bee3d
1 Parent(s): e1dd0fa

AudioTokenDemo

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -91,6 +91,9 @@ class AudioTokenWrapper(torch.nn.Module):
91
 
92
  def greet(audio):
93
  audio = audio[-1].astype(np.float32, order='C') / 32768.0
 
 
 
94
  weight_dtype = torch.float32
95
  prompt = 'a photo of <*>'
96
 
@@ -140,6 +143,6 @@ if __name__ == "__main__":
140
  outputs="image",
141
  title='AudioToken',
142
  description=description,
143
- examples=examples
144
  )
145
  demo.launch()
 
91
 
92
  def greet(audio):
93
  audio = audio[-1].astype(np.float32, order='C') / 32768.0
94
+ if audio.ndim == 2:
95
+ audio = audio.sum(axis=1) / 2
96
+
97
  weight_dtype = torch.float32
98
  prompt = 'a photo of <*>'
99
 
 
143
  outputs="image",
144
  title='AudioToken',
145
  description=description,
146
+ # examples=examples
147
  )
148
  demo.launch()