routes.py 1.2 KB

1234567891011121314151617181920212223242526
  1. from fastapi import APIRouter, Depends
  2. from .deps import get_speech_service, get_understand_image_service, get_copywriting_evaluation_service
  3. from ..schemas.base import DataResponse, TextToSpeechRequest, UnderstandImageRequest, CopywritingEvaluationRequest
  4. from ..services.speech_service import SpeechService
  5. from ..services.vl_service import VLService
  6. from ..services.evaluation_service import EvaluationService
  7. router = APIRouter()
  8. @router.get("/ping", tags=["default"])
  9. def ping():
  10. return {"message": "pong"}
  11. @router.post('/llm/text-to-speech', response_model=DataResponse, tags=["llm"])
  12. def text_to_speech(req: TextToSpeechRequest, service: SpeechService = Depends(get_speech_service)):
  13. return service.text_to_speech(req)
  14. @router.post('/llm/understand-image', response_model=DataResponse, tags=["llm"])
  15. def understand_image(req: UnderstandImageRequest, service: VLService = Depends(get_understand_image_service)):
  16. return service.understand_image(req)
  17. @router.post('/llm/copywriting-evaluation', response_model=DataResponse, tags=["llm"])
  18. def copywriting_evaluation(req: CopywritingEvaluationRequest, service: EvaluationService = Depends(get_copywriting_evaluation_service)):
  19. return service.copywriting_evaluation(req)