|
from fastapi import FastAPI |
|
|
|
import outetts |
|
import os |
|
|
|
|
|
interface = outetts.Interface( |
|
config=outetts.ModelConfig.auto_config( |
|
model=outetts.Models.VERSION_1_0_SIZE_1B, |
|
|
|
backend=outetts.Backend.LLAMACPP, |
|
quantization=outetts.LlamaCppQuantization.FP16 |
|
|
|
|
|
) |
|
) |
|
|
|
|
|
speaker = interface.load_default_speaker("EN-FEMALE-1-NEUTRAL") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output = interface.generate( |
|
config=outetts.GenerationConfig( |
|
text="Hello, how are you doing?", |
|
generation_type=outetts.GenerationType.CHUNKED, |
|
speaker=speaker, |
|
sampler_config=outetts.SamplerConfig( |
|
temperature=0.4 |
|
), |
|
) |
|
) |
|
|
|
|
|
output_path = os.path.join(os.getcwd(),"output.wav") |
|
output.save(output_path) |
|
|
|
app = FastAPI() |
|
|
|
@app.get("/") |
|
def greet_json(): |
|
return {"Hello": "World!"} |
|
|