Spaces:
Runtime error
Runtime error
File size: 552 Bytes
dcd68c4 3229324 932db78 dcd68c4 932db78 dcd68c4 932db78 dcd68c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
@app.post('/tts')
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) |