spring-ai
spring-ai copied to clipboard
feat: add hugging face text to image integration
Hi,
I was experimenting with Spring AI and some models deployed on hugging face, realizing that a lot of stuff is missing for huggingface explaining the reason for this PR.
The changes provide a baseline implementation for querying text-to-image models deployed on huggingface.
I tried to align the code as much as possible on the existing implementation for chat models, however in order to support different image types on the api, I was required to add a custom template for swagger codegen, since the default templates generate a priorization for application/json with regards to the accept header (which in turn allows the generated api to retrieve base64 encoded strings only, leading to the fact, that only PNG images could be generated). This seems unfavorable for an text-to-image api. Thus the modified templates adds the possibility to specify the desired image type on requesting the model.
- adds huggingface text-to-image integration
- provided modified template for swagger codegen (only used for text-to-image inference api)