Skip to content

Commit

Permalink
Merge pull request ERLANRAHMAT#12 from Yuri-Neko/patch-2
Browse files Browse the repository at this point in the history
Create scraper-ai.js
  • Loading branch information
ERLANRAHMAT committed Jul 11, 2023
2 parents 9114b52 + b74254a commit 2e45afe
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/scraper-ai.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const fetch = require('node-fetch')
const cheerio = require('cheerio')

async function animedif(data) {
const response = await fetch(
"https://api-inference.huggingface.co/models/Ojimi/anime-kawai-diffusion",
{
headers: { Authorization: "Bearer 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" },
method: "POST",
body: JSON.stringify(data),
}
)
const result = await response.blob();
let arrayBuffer = await result.arrayBuffer();
const buffer = Buffer.from(arrayBuffer, 'base64')
return buffer
}

async function stabledif(data) {
const response = await fetch(
"https://api-inference.huggingface.co/models/stablediffusionapi/lyrielv16",
{
headers: { Authorization: "Bearer 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" },
method: "POST",
body: JSON.stringify(data),
}
)
const result = await response.blob();
let arrayBuffer = await result.arrayBuffer();
const buffer = Buffer.from(arrayBuffer, 'base64')
return buffer
}


module.exports = {
animedif,
stabledif,
}

0 comments on commit 2e45afe

Please sign in to comment.