Spaces:
Runtime error
Runtime error
from fastapi import FastAPI | |
import uvicorn | |
import faiss | |
from sentence_transformers import SentenceTransformer | |
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') | |
index = faiss.IndexFlatL2(model.get_sentence_embedding_dimension()) # build the index | |
index.add(model.encode(['hello'])) | |
app = FastAPI() | |
async def transcribe(text: str): | |
embeddings = model.encode([text]) | |
# store the text to a file | |
return embeddings[0] | |
if __name__ == '__main__': | |
uvicorn.run('app:app', host='0.0.0.0', port=7860) |