Spaces:
Sleeping
Sleeping
guyyariv
commited on
Commit
·
0211bb6
1
Parent(s):
fb6b8b9
AudioTokenDemo
Browse files
app.py
CHANGED
|
@@ -95,6 +95,8 @@ def greet(audio):
|
|
| 95 |
prompt = 'a photo of <*>'
|
| 96 |
|
| 97 |
audio_values = torch.unsqueeze(torch.tensor(audio), dim=0).to(device).to(dtype=weight_dtype)
|
|
|
|
|
|
|
| 98 |
aud_features = model.aud_encoder.extract_features(audio_values)[1]
|
| 99 |
audio_token = model.embedder(aud_features)
|
| 100 |
|
|
@@ -126,7 +128,7 @@ if __name__ == "__main__":
|
|
| 126 |
|
| 127 |
examples = [
|
| 128 |
# ["assets/train.wav"],
|
| 129 |
-
["assets/dog barking.wav"],
|
| 130 |
["assets/airplane taking off.wav"],
|
| 131 |
# ["assets/electric guitar.wav"],
|
| 132 |
# ["assets/female sings.wav"],
|
|
|
|
| 95 |
prompt = 'a photo of <*>'
|
| 96 |
|
| 97 |
audio_values = torch.unsqueeze(torch.tensor(audio), dim=0).to(device).to(dtype=weight_dtype)
|
| 98 |
+
if audio_values.ndim == 1:
|
| 99 |
+
audio_values = torch.unsqueeze(audio_values, dim=0)
|
| 100 |
aud_features = model.aud_encoder.extract_features(audio_values)[1]
|
| 101 |
audio_token = model.embedder(aud_features)
|
| 102 |
|
|
|
|
| 128 |
|
| 129 |
examples = [
|
| 130 |
# ["assets/train.wav"],
|
| 131 |
+
# ["assets/dog barking.wav"],
|
| 132 |
["assets/airplane taking off.wav"],
|
| 133 |
# ["assets/electric guitar.wav"],
|
| 134 |
# ["assets/female sings.wav"],
|