StreamlitChat_NEW / utils.py
pragneshbarik's picture
improved dependancies
ab843c1
raw
history blame contribute delete
418 Bytes
import os
from dotenv import load_dotenv
from sentence_transformers import SentenceTransformer
load_dotenv()
API_TOKEN = os.getenv('HF_TOKEN')
API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2Fall-distilroberta-v1%26quot%3B%3C%2Fspan%3E%3C!-- HTML_TAG_END -->
headers = {"Authorization": f"Bearer {API_TOKEN}"}
def generate_text_embeddings(texts):
model = SentenceTransformer('all-distilroberta-v1')
return model.encode(texts)
# Example usage: