Spaces:
Running
Running
File size: 418 Bytes
d60dac5 ab843c1 d60dac5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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:
|