musiccaps
1.0.0
使用Vector数据库Pinecone和Google AI的MusicCaps数据集的语义搜索演示。
逐步浏览笔记本initionpinecone-index.ipynb到
笔记:
YOUR_API_KEY和YOUR_REGION替换为从Pinecone控制台中的API键选项卡所示的值。笔记本末尾有一个示例查询。替换query值,以通过Musiccaps数据集进行语义搜索实验。
query = 'lively eastern european folk music with strings outdoors'
search_pinecone ( query ){ 'matches' : [{ 'id' : '5327' ,
'metadata' : { 'aspect_list' : "['romanian folk music', 'live "
"performance', 'instrumental', "
"'accordion', 'upright bass', "
"'acoustic guitar', 'percussion', "
"'fiddle', 'lively', 'upbeat', "
"'joyful']" ,
'audioset_positive_labels' : '/m/0mkg' ,
'author_id' : 9.0 ,
'caption' : 'This is the live performance of a '
'Romanian folk music piece. It is '
'instrumental. There is an accordion '
'playing the leading melody while the '
'fiddle, acoustic guitar and the upright '
'bass play in the background. There is a '
'percussive element in the rhythmic '
'background. The atmosphere is lively '
'and joyful.' ,
'end_s' : 30.0 ,
'is_audioset_eval' : False ,
'is_balanced_subset' : False ,
'start_s' : 20.0 ,
'ytid' : 'xR2p3UED4VU' },
'score' : 0.658422887 ,
'values' : []},
...
],
'namespace' : '' }您会了解结果阅读caption字段并注意score 。 ytid是YouTube视频ID, start_s定义了相关视频的起点。
streamlit run search-app.py 
要运行搜索应用程序,您需要
git clone https://github.com/ben-ogden/musiccaps.git
cd musiccaps
pipenv shell
pipenv install pinecone-client streamlit
streamlit version
...
Streamlit, version 1.22.0在〜/.streamlit/secrets.toml中创建一个秘密文件并设置您的PINECONE_KEY和PINECONE_ENV
PINECONE_KEY = "..." streamlit run search-app.py 
该数据集可能是实验混合搜索或使用metadata aspect_list中的值作为关键字中的值的元数据过滤的好候选者。