StreamlitChat_NEW / utils.py
pragneshbarik's picture
improved dependancies
ab843c1
raw
history blame
418 Bytes
import os
from dotenv import load_dotenv
from sentence_transformers import SentenceTransformer
load_dotenv()
API_TOKEN = os.getenv('HF_TOKEN')
API_URL = "https://api-inference.huggingface.co/models/all-distilroberta-v1"
headers = {"Authorization": f"Bearer {API_TOKEN}"}
def generate_text_embeddings(texts):
model = SentenceTransformer('all-distilroberta-v1')
return model.encode(texts)
# Example usage: