Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -3,11 +3,13 @@ import torch
|
|
3 |
import pickle
|
4 |
from transformers import ClapModel, ClapProcessor
|
5 |
from sklearn.metrics.pairwise import cosine_similarity
|
|
|
6 |
|
7 |
def load_results_from_pickle(input_file):
|
8 |
with open(input_file, 'rb') as f:
|
9 |
return pickle.load(f)
|
10 |
|
|
|
11 |
def compare_text_to_audio_embeddings(text, pickle_file):
|
12 |
model = ClapModel.from_pretrained("laion/larger_clap_music_and_speech").to(0)
|
13 |
processor = ClapProcessor.from_pretrained("laion/larger_clap_music_and_speech")
|
|
|
3 |
import pickle
|
4 |
from transformers import ClapModel, ClapProcessor
|
5 |
from sklearn.metrics.pairwise import cosine_similarity
|
6 |
+
import spaces
|
7 |
|
8 |
def load_results_from_pickle(input_file):
|
9 |
with open(input_file, 'rb') as f:
|
10 |
return pickle.load(f)
|
11 |
|
12 |
+
@spaces.GPU
|
13 |
def compare_text_to_audio_embeddings(text, pickle_file):
|
14 |
model = ClapModel.from_pretrained("laion/larger_clap_music_and_speech").to(0)
|
15 |
processor = ClapProcessor.from_pretrained("laion/larger_clap_music_and_speech")
|