from fastapi import FastAPI from pydantic import BaseModel import app # import the functions from app.py app_api = FastAPI() class TextRequest(BaseModel): text: str @app_api.post("/synthesize/") async def synthesize(request: TextRequest): processed_text = app.preprocess_text(request.text) synthesized_audio = app.synthesize_speech(processed_text) return {"processed_text": processed_text, "audio": synthesized_audio} if __name__ == "__main__": import uvicorn uvicorn.run(app_api, host="0.0.0.0", port=8000)