Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def fetch_dataset_info_auth(dataset_id, hf_token):
|
| 2 |
"""Fetch dataset information with authentication"""
|
| 3 |
info_url = f"https://huggingface.co/api/datasets/{dataset_id}"
|
|
@@ -163,17 +181,12 @@ def render_video_result(result):
|
|
| 163 |
|
| 164 |
if video_url:
|
| 165 |
st.video(video_url)
|
| 166 |
-
if st.button(f"π Audio Summary", key=f"audio_{result.get('video_id', '')}"):
|
| 167 |
-
summary = f"Video summary: {result.get('title', '')}. {result.get('description', '')[:200]}"
|
| 168 |
-
audio_file = asyncio.run(generate_speech(summary))
|
| 169 |
-
if audio_file:
|
| 170 |
-
st.audio(audio_file)
|
| 171 |
|
| 172 |
def main():
|
| 173 |
-
st.title("π₯
|
| 174 |
|
| 175 |
# Get HF token from secrets or user input
|
| 176 |
-
if
|
| 177 |
st.session_state['hf_token'] = st.secrets.get("HF_TOKEN", None)
|
| 178 |
|
| 179 |
if not st.session_state['hf_token']:
|
|
@@ -251,7 +264,7 @@ def main():
|
|
| 251 |
|
| 252 |
# Sidebar
|
| 253 |
with st.sidebar:
|
| 254 |
-
st.subheader("βοΈ
|
| 255 |
if st.button("ποΈ Clear History"):
|
| 256 |
st.session_state['search_history'] = []
|
| 257 |
st.experimental_rerun()
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
from sentence_transformers import SentenceTransformer
|
| 5 |
+
from sklearn.metrics.pairwise import cosine_similarity
|
| 6 |
+
import requests
|
| 7 |
+
from datetime import datetime
|
| 8 |
+
|
| 9 |
+
# Initialize session state variables
|
| 10 |
+
if 'search_history' not in st.session_state:
|
| 11 |
+
st.session_state['search_history'] = []
|
| 12 |
+
if 'search_columns' not in st.session_state:
|
| 13 |
+
st.session_state['search_columns'] = []
|
| 14 |
+
if 'initial_search_done' not in st.session_state:
|
| 15 |
+
st.session_state['initial_search_done'] = False
|
| 16 |
+
if 'hf_token' not in st.session_state:
|
| 17 |
+
st.session_state['hf_token'] = None
|
| 18 |
+
|
| 19 |
def fetch_dataset_info_auth(dataset_id, hf_token):
|
| 20 |
"""Fetch dataset information with authentication"""
|
| 21 |
info_url = f"https://huggingface.co/api/datasets/{dataset_id}"
|
|
|
|
| 181 |
|
| 182 |
if video_url:
|
| 183 |
st.video(video_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
def main():
|
| 186 |
+
st.title("π₯ Video Dataset Search")
|
| 187 |
|
| 188 |
# Get HF token from secrets or user input
|
| 189 |
+
if not st.session_state['hf_token']:
|
| 190 |
st.session_state['hf_token'] = st.secrets.get("HF_TOKEN", None)
|
| 191 |
|
| 192 |
if not st.session_state['hf_token']:
|
|
|
|
| 264 |
|
| 265 |
# Sidebar
|
| 266 |
with st.sidebar:
|
| 267 |
+
st.subheader("βοΈ Search History")
|
| 268 |
if st.button("ποΈ Clear History"):
|
| 269 |
st.session_state['search_history'] = []
|
| 270 |
st.experimental_rerun()
|