routes.py 862 B

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