import pinecone import streamlit as st from sentence_transformers import SentenceTransformer index_id = "youtube-search" pinecone.init( api_key='e815acaa-c5d2-4280-85bc-4994c59a5ee4', # app.pinecone.io environment="us-west1-gcp" # find next to API key ) index = pinecone.Index(index_id) query = st.text_input("Query (exmaple: when to raise funds?)") if query: model_id = "multi-qa-mpnet-base-dot-v1" model = SentenceTransformer(model_id) xq = model.encode(query).tolist() output = index.query(xq, top_k=5, include_metadata=True) for o in output["matches"]: url = o["id"].split("-")[0] start = o["metadata"]["start"] url_time = "https://youtu.be/" + url+ f"?t={start}" text = o["metadata"]["text"] st.write(url_time) st.write(text)