Skip to content

Commit

Permalink
feat: using dataview and update warm models
Browse files Browse the repository at this point in the history
  • Loading branch information
huuquyet committed Sep 21, 2024
1 parent 17c7eb2 commit 723d8fd
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 39 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This action generate awesome wallpapers using HuggingFace Inference API (serverl
<div align="center">
<img alt="Awesome Wallpapers" src="./assets/wallpaper.jpg">

<!-- START_CAPTION -->
*An expansive lavender field, undulating gently under the soft breeze, with a majestic, snow-capped mountain range in the distance* by [digiplay/AbsoluteReality_v1.8.1](https://hf.co/digiplay/AbsoluteReality_v1.8.1)
<!-- START_CAPTION -->
*An expansive lavender field, undulating gently under the soft breeze, with a majestic, snow-capped mountain range in the distance* by [digiplay/AbsoluteReality_v1.8.1](https://hf.co/digiplay/AbsoluteReality_v1.8.1)
<!-- END_CAPTION -->
</div>

Expand All @@ -27,12 +27,14 @@ Then add to the [secrets for the repository](https://docs.github.com/en/actions/

## List of models

- [stabilityai/stable-diffusion-3-medium-diffusers](https://hf.co/stabilityai/stable-diffusion-3-medium-diffusers)
- [RunDiffusion/Juggernaut-X-v10](https://hf.co/RunDiffusion/Juggernaut-X-v10)
- [Yntec/epiCPhotoGasm](https://hf.co/Yntec/epiCPhotoGasm)
- [SG161222/Realistic_Vision_V6.0_B1_noVAE](https://hf.co/SG161222/Realistic_Vision_V6.0_B1_noVAE)
- [digiplay/AbsoluteReality_v1.8.1](https://hf.co/digiplay/AbsoluteReality_v1.8.1)
- [Corcelio/mobius](https://hf.co/Corcelio/mobius)
- [black-forest-labs/FLUX.1-dev](https://hf.co/black-forest-labs/FLUX.1-dev)
- [Shakker-Labs/FLUX.1-dev-LoRA-Dark-Fantasy](https://hf.co/Shakker-Labs/FLUX.1-dev-LoRA-Dark-Fantasy)
- [XLabs-AI/flux-RealismLora](https://hf.co/XLabs-AI/flux-RealismLora)
- [aleksa-codes/flux-ghibsky-illustration](https://hf.co/aleksa-codes/flux-ghibsky-illustration)
- [prithivMLmods/Canopus-LoRA-Flux-FaceRealism](https://hf.co/prithivMLmods/Canopus-LoRA-Flux-FaceRealism)
- [digiplay/insaneRealistic_v1](https://hf.co/digiplay/insaneRealistic_v1)
[dreamlike-art/dreamlike-photoreal-2.0](https://hf.co/dreamlike-art/dreamlike-photoreal-2.0)
[CiroN2022/microverse-creator](https://hf.co/CiroN2022/microverse-creator)

## Outputs

Expand Down
Binary file modified bun.lockb
Binary file not shown.
23 changes: 11 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26821,8 +26821,6 @@ var __webpack_exports__ = {};
// ESM COMPAT FLAG
__nccwpck_require__.r(__webpack_exports__);

;// CONCATENATED MODULE: external "node:buffer"
const external_node_buffer_namespaceObject = require("node:buffer");
;// CONCATENATED MODULE: external "node:fs/promises"
const promises_namespaceObject = require("node:fs/promises");
;// CONCATENATED MODULE: external "node:process"
Expand All @@ -26839,12 +26837,14 @@ const prompts_namespaceObject = JSON.parse('["A pristine, turquoise glacier lake

// The list of text-to-image models that support inference API
const MODELS = [
'stabilityai/stable-diffusion-3-medium-diffusers',
'SG161222/Realistic_Vision_V6.0_B1_noVAE',
'RunDiffusion/Juggernaut-X-v10',
'Yntec/epiCPhotoGasm',
'digiplay/AbsoluteReality_v1.8.1',
'Corcelio/mobius',
'black-forest-labs/FLUX.1-dev',
'Shakker-Labs/FLUX.1-dev-LoRA-Dark-Fantasy',
'XLabs-AI/flux-RealismLora',
'aleksa-codes/flux-ghibsky-illustration',
'prithivMLmods/Canopus-LoRA-Flux-FaceRealism',
'digiplay/insaneRealistic_v1',
'dreamlike-art/dreamlike-photoreal-2.0',
'CiroN2022/microverse-creator',
];
// The patterns to set the caption of image
const START_CAPTION = '<!-- START_CAPTION -->';
Expand Down Expand Up @@ -26884,7 +26884,6 @@ async function updateReadme(model_id, prompt) {




// Envinroment secrets get from https://huggingface.co/settings/tokens
const API_TOKEN = external_node_process_namespaceObject.env.HF_API_TOKEN;
/** Fetch text-to-image models with inference api */
Expand Down Expand Up @@ -26929,10 +26928,10 @@ async function run() {
},
}, model_id).then(async (response) => {
const destinationPath = './assets/wallpaper.jpg';
// create buffer from response
const buffer = external_node_buffer_namespaceObject.Buffer.from(response);
// create dataview from response
const dataView = new DataView(response);
// Save image to a local file
await (0,promises_namespaceObject.writeFile)(destinationPath, buffer);
await (0,promises_namespaceObject.writeFile)(destinationPath, dataView);
core.info(`Image saved to ${destinationPath} successfully ✅ 💖`);
// Set outputs for other workflow steps to use
core.setOutput('model_id', model_id);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"@actions/core": "^1.10.1"
},
"devDependencies": {
"@types/bun": "^1.1.8",
"@types/bun": "^1.1.10",
"@vercel/ncc": "^0.38.1",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
},
"jest": {
"preset": "ts-jest",
Expand Down
14 changes: 8 additions & 6 deletions src/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
API_TOKEN = getenv("HF_API_TOKEN")
# The list of text-to-image models that support inference API
MODELS = [
'stabilityai/stable-diffusion-3-medium-diffusers',
'SG161222/Realistic_Vision_V6.0_B1_noVAE',
'RunDiffusion/Juggernaut-X-v10',
'Yntec/epiCPhotoGasm',
'digiplay/AbsoluteReality_v1.8.1',
'Corcelio/mobius',
'black-forest-labs/FLUX.1-dev',
'Shakker-Labs/FLUX.1-dev-LoRA-Dark-Fantasy',
'XLabs-AI/flux-RealismLora',
'aleksa-codes/flux-ghibsky-illustration',
'prithivMLmods/Canopus-LoRA-Flux-FaceRealism',
'digiplay/insaneRealistic_v1',
'dreamlike-art/dreamlike-photoreal-2.0',
'CiroN2022/microverse-creator',
]

random_model = random.choice(MODELS)
Expand Down
7 changes: 3 additions & 4 deletions src/generate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Buffer } from 'node:buffer'
import { writeFile } from 'node:fs/promises'
import { env } from 'node:process'
import * as core from '@actions/core'
Expand Down Expand Up @@ -58,10 +57,10 @@ export async function run(): Promise<void> {
model_id
).then(async (response) => {
const destinationPath = './assets/wallpaper.jpg'
// create buffer from response
const buffer = Buffer.from(response)
// create dataview from response
const dataView = new DataView(response)
// Save image to a local file
await writeFile(destinationPath, buffer)
await writeFile(destinationPath, dataView)
core.info(`Image saved to ${destinationPath} successfully ✅ 💖`)

// Set outputs for other workflow steps to use
Expand Down
14 changes: 8 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { default as prompts } from '../assets/prompts.json'

// The list of text-to-image models that support inference API
const MODELS: string[] = [
'stabilityai/stable-diffusion-3-medium-diffusers',
'SG161222/Realistic_Vision_V6.0_B1_noVAE',
'RunDiffusion/Juggernaut-X-v10',
'Yntec/epiCPhotoGasm',
'digiplay/AbsoluteReality_v1.8.1',
'Corcelio/mobius',
'black-forest-labs/FLUX.1-dev',
'Shakker-Labs/FLUX.1-dev-LoRA-Dark-Fantasy',
'XLabs-AI/flux-RealismLora',
'aleksa-codes/flux-ghibsky-illustration',
'prithivMLmods/Canopus-LoRA-Flux-FaceRealism',
'digiplay/insaneRealistic_v1',
'dreamlike-art/dreamlike-photoreal-2.0',
'CiroN2022/microverse-creator',
]

// The patterns to set the caption of image
Expand Down

0 comments on commit 723d8fd

Please sign in to comment.