-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: add hugging face text to image integration #1162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
thanks you very much, i did the original quick pass around hugging face and appreciate this improvement. |
thank you for your response. I wasn't sure if this PR would be considered useful at this moment. However I think I have to make smaller adjustments, as some aspects of the codebase have changed in the meantime, due to other merged PRs, thus marking it as draft. Will take some time, since I'm on vacation right now :D |
@markpollack should be now ready to review. If you see any room for improvements, kindly let me know |
97e4628
to
89ffb0c
Compare
89ffb0c
to
0038772
Compare
import org.springframework.ai.huggingface.model.chat.AllOfGenerateResponseDetails; | ||
import org.springframework.ai.huggingface.model.chat.GenerateParameters; | ||
import org.springframework.ai.huggingface.model.chat.GenerateRequest; | ||
import org.springframework.ai.huggingface.model.chat.GenerateResponse; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like your code style settings don't align with those of the project. None of these lines should change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not related to code style, I have changed the buildpath in openapi codegen configuration to improve the package structure of generated code. Is this an undesired change ?
However I used the default code styles of my IDE, changed it now to settings mentioned here: https://github.com/spring-projects/spring-framework/wiki/IntelliJ-IDEA-Editor-Settings
Probably going to clash heavily with #486, but then would be a nice addition IMO |
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.