Skip to content
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

feat(image): add AI-generated avatars #3126

Draft
wants to merge 2 commits into
base: next
Choose a base branch
from
Draft

feat(image): add AI-generated avatars #3126

wants to merge 2 commits into from

Conversation

matthewmayer
Copy link
Contributor

@matthewmayer matthewmayer commented Sep 21, 2024

Draft PR to explore the best API for this. CDN URL will need to be replaced with final one.

Uses 50 male and 50 female images generated as part of discussion here #465 (comment)

fix #465
fix #2173

Screenshot 2024-09-17 at 22 14 29

Copy link

netlify bot commented Sep 21, 2024

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 2bb43b9
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/66ee35822e5fee00081ac85d
😎 Deploy Preview https://deploy-preview-3126.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Sep 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.96%. Comparing base (dfbf6c4) to head (2bb43b9).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3126      +/-   ##
==========================================
- Coverage   99.97%   99.96%   -0.01%     
==========================================
  Files        2776     2776              
  Lines      226341   226352      +11     
  Branches      945      946       +1     
==========================================
- Hits       226289   226281       -8     
- Misses         52       71      +19     
Files with missing lines Coverage Δ
src/modules/image/index.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

@ST-DDT
Copy link
Member

ST-DDT commented Sep 21, 2024

As you wrote in the comment. We would like to host these images inside the faker org so we dont loose access to them again. The idea is to use a separate asset repository (to avoid bloating the main repo) and to put the images there but we didnt have enough time yet to plan the exact structure.
We are open to suggestions.

@ST-DDT ST-DDT added c: feature Request for new feature p: 1-normal Nothing urgent m: image Something is referring to the image module labels Sep 21, 2024
@ST-DDT ST-DDT added this to the v9.x milestone Sep 21, 2024
*
* @since 9.1.0
*/
avatarAI(options?: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name doesnt really tell what this method returns, only how the result was generated.
As discussed elsewhere I would like to call these portraits, but I'm open to other suggestions.

https://en.wikipedia.org/wiki/Portrait

*/
sex?: SexType;
}): string {
const type = options?.sex ?? this.faker.person.sexType();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use our normal destructuring syntax for this.

@Shinigami92
Copy link
Member

When we later store the images in the faker org, we should also place a file for each image with meta data, including: "used model, prompt, negative prompt, seed, parameters, ..."

@ST-DDT
Copy link
Member

ST-DDT commented Sep 21, 2024

Lets put the technical discussion of what to put where and how in a separate issue.

@matthewmayer
Copy link
Contributor Author

As you wrote in the comment. We would like to host these images inside the faker org so we dont loose access to them again. The idea is to use a separate asset repository (to avoid bloating the main repo) and to put the images there but we didnt have enough time yet to plan the exact structure.

We are open to suggestions.

Yep. I'd suggest say faker-media as repo name (in case we want video or audio later), then (versioned?) subfolders for different methods (we might want e.g. dummy company logos in the future). The most important thing is that urls are stable as once the urls are generated they might be stored in a database so we want them accessible "forever".

@Shinigami92 Shinigami92 changed the title feat(image): Add AI-generated avatars feat(image): add AI-generated avatars Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature m: image Something is referring to the image module p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make internet.avatar() sex or gender aware Use fake (generated) images for faker opposed to real people
3 participants