Download ingest.py from Master-Ali/chatbot-backend: direct link, hf CLI and curl.
- Browser
- Download file 686 Bytes
-
https://huggingface.co/spaces/Master-Ali/chatbot-backend/resolve/main/ingest.py
- Command line
-
hf download hf://spaces/Master-Ali/chatbot-backend/ingest.py
-
curl -L -o ingest.py https://huggingface.co/spaces/Master-Ali/chatbot-backend/resolve/main/ingest.py
686 Bytes
| # from chromadb import Client | |
| # from sentence_transformers import SentenceTransformer | |
| # client = Client(persist_directory="./chroma_db") | |
| # collection = client.get_or_create_collection(name="docs") | |
| # embed_model = SentenceTransformer("all-MiniLM-L6-v2") | |
| # docs = [ | |
| # "Welcome to my bakery. We sell cookies and cakes.", | |
| # "Our delivery policy: we deliver within 2 days in Karachi.", | |
| # "Contact us at info@example.com for queries." | |
| # ] | |
| # for i, doc in enumerate(docs): | |
| # emb = embed_model.encode(doc).tolist() | |
| # collection.add( | |
| # documents=[doc], | |
| # embeddings=[emb], | |
| # ids=[str(i)] | |
| # ) | |
| # client.persist() | |
| # print("Vector DB created!") | |