Spaces:
Sleeping
Sleeping
NotShrirang
commited on
Commit
·
7d28c9b
1
Parent(s):
fe5df96
feat: add caption for audios
Browse files
data_search/data_search_page.py
CHANGED
@@ -100,7 +100,7 @@ def data_search(clip_model, preprocess, text_embedding_model, whisper_model, dev
|
|
100 |
audio_indices = search_text_index(text_input, audio_index, text_embedding_model, k=3)
|
101 |
if not image_index and not text_index and not audio_index:
|
102 |
st.error("No Data Found! Please add data to the database.")
|
103 |
-
st.subheader("
|
104 |
cols = st.columns(3)
|
105 |
for i in range(3):
|
106 |
with cols[i]:
|
@@ -114,15 +114,19 @@ def data_search(clip_model, preprocess, text_embedding_model, whisper_model, dev
|
|
114 |
cosine_similarity = torch.cosine_similarity(image_features, text_features)
|
115 |
st.write(f"Similarity: {cosine_similarity.item() * 100:.2f}%")
|
116 |
st.image(image_path)
|
|
|
117 |
cols = st.columns(3)
|
118 |
for i in range(3):
|
119 |
with cols[i]:
|
120 |
if text_index:
|
121 |
text_content = text_data['content'].iloc[text_indices[0][i]]
|
122 |
st.write(text_content)
|
|
|
123 |
cols = st.columns(3)
|
124 |
for i in range(3):
|
125 |
with cols[i]:
|
126 |
if audio_index:
|
127 |
audio_path = audio_data['path'].iloc[audio_indices[0][i]]
|
128 |
-
|
|
|
|
|
|
100 |
audio_indices = search_text_index(text_input, audio_index, text_embedding_model, k=3)
|
101 |
if not image_index and not text_index and not audio_index:
|
102 |
st.error("No Data Found! Please add data to the database.")
|
103 |
+
st.subheader("Image Results")
|
104 |
cols = st.columns(3)
|
105 |
for i in range(3):
|
106 |
with cols[i]:
|
|
|
114 |
cosine_similarity = torch.cosine_similarity(image_features, text_features)
|
115 |
st.write(f"Similarity: {cosine_similarity.item() * 100:.2f}%")
|
116 |
st.image(image_path)
|
117 |
+
st.subheader("Text Results")
|
118 |
cols = st.columns(3)
|
119 |
for i in range(3):
|
120 |
with cols[i]:
|
121 |
if text_index:
|
122 |
text_content = text_data['content'].iloc[text_indices[0][i]]
|
123 |
st.write(text_content)
|
124 |
+
st.subheader("Audio Results")
|
125 |
cols = st.columns(3)
|
126 |
for i in range(3):
|
127 |
with cols[i]:
|
128 |
if audio_index:
|
129 |
audio_path = audio_data['path'].iloc[audio_indices[0][i]]
|
130 |
+
audio_content = audio_data['content'].iloc[audio_indices[0][i]]
|
131 |
+
st.audio(audio_path)
|
132 |
+
st.write(f"_{audio_content}_")
|