text-to-speech / app.py
Daryl Fung
added missing imports
3229324
raw
history blame
399 Bytes
from fastapi import FastAPI
import uvicorn
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
app = FastAPI()
@app.post('/tts')
async def transcribe(text: str):
embeddings = model.encode([text], vad_filter=True)
return embeddings[0]
if __name__ == '__main__':
uvicorn.run('app:app', host='0.0.0.0', port=7860)