Spaces:
Build error
Build error
Commit
·
052dec1
1
Parent(s):
78c837b
space.gpu
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import os
|
5 |
import yaml
|
6 |
|
|
|
7 |
import gradio as gr
|
8 |
|
9 |
import librosa
|
@@ -22,6 +23,8 @@ if torch.cuda.is_available():
|
|
22 |
else:
|
23 |
device = 'cpu'
|
24 |
|
|
|
|
|
25 |
def load_laionclap():
|
26 |
model = laion_clap.CLAP_Module(enable_fusion=True, amodel='HTSAT-tiny').to(device)
|
27 |
model.load_ckpt(ckpt='630k-audioset-fusion-best.pt')
|
@@ -88,6 +91,7 @@ def load_audio(file_path, target_sr=44100, duration=33.25, start=0.0):
|
|
88 |
return data
|
89 |
|
90 |
|
|
|
91 |
@torch.no_grad()
|
92 |
def compute_laionclap_text_audio_sim(audio_file, laionclap_model, outputs):
|
93 |
try:
|
@@ -137,6 +141,7 @@ model = prepare_model(
|
|
137 |
)
|
138 |
|
139 |
|
|
|
140 |
def inference_item(name, prompt):
|
141 |
item = {
|
142 |
'name': str(name),
|
|
|
4 |
import os
|
5 |
import yaml
|
6 |
|
7 |
+
import spaces
|
8 |
import gradio as gr
|
9 |
|
10 |
import librosa
|
|
|
23 |
else:
|
24 |
device = 'cpu'
|
25 |
|
26 |
+
|
27 |
+
@spaces.GPU
|
28 |
def load_laionclap():
|
29 |
model = laion_clap.CLAP_Module(enable_fusion=True, amodel='HTSAT-tiny').to(device)
|
30 |
model.load_ckpt(ckpt='630k-audioset-fusion-best.pt')
|
|
|
91 |
return data
|
92 |
|
93 |
|
94 |
+
@spaces.GPU
|
95 |
@torch.no_grad()
|
96 |
def compute_laionclap_text_audio_sim(audio_file, laionclap_model, outputs):
|
97 |
try:
|
|
|
141 |
)
|
142 |
|
143 |
|
144 |
+
@spaces.GPU
|
145 |
def inference_item(name, prompt):
|
146 |
item = {
|
147 |
'name': str(name),
|