
Stable Diffusion Scraper
Deprecated
Pricing
Pay per usage
Go to Store

Stable Diffusion Scraper
Deprecated
Get instant access to Stable Diffusion and hundreds of other generative AI models hosted on Replicate.
0.0 (0)
Pricing
Pay per usage
1
Total users
11
Monthly users
3
Last modified
2 years ago
.actor/Dockerfile
1# Specify the base Docker image. You can read more about
2# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
3# You can also use any other image from Docker Hub.
4FROM apify/actor-node:18
5
6# Copy just package.json and package-lock.json
7# to speed up the build using Docker layer cache.
8COPY package*.json ./
9
10# Install NPM packages, skip optional and development dependencies to
11# keep the image small. Avoid logging too much and print the dependency
12# tree for debugging
13RUN npm --quiet set progress=false \
14 && npm install --omit=dev --omit=optional \
15 && echo "Installed NPM packages:" \
16 && (npm list --omit=dev --all || true) \
17 && echo "Node.js version:" \
18 && node --version \
19 && echo "NPM version:" \
20 && npm --version \
21 && rm -r ~/.npm
22
23# Next, copy the remaining files and directories with the source code.
24# Since we do this after NPM install, quick build will be really fast
25# for most source file changes.
26COPY . ./
27
28
29# Run the image.
30CMD npm start --silent
.actor/actor.json
1{
2 "actorSpecification": 1,
3 "name": "my-actor",
4 "title": "Scrape single page in JavaScript",
5 "description": "Scrape data from single page with provided URL.",
6 "version": "0.0",
7 "meta": {
8 "templateId": "js-start"
9 },
10 "input": "./input_schema.json",
11 "dockerfile": "./Dockerfile"
12}
.actor/input_schema.json
1{
2 "title": "Get instant access to Stable Diffusion and hundres of other generative AI models hosted on Replicate.",
3 "type": "object",
4 "schemaVersion": 1,
5 "properties": {
6 "prompt": {
7 "title": "Prompt",
8 "type": "string",
9 "description": "What to create ✨",
10 "editor": "textfield",
11 "prefill": "an astronaut riding on a horse"
12 },
13 "model": {
14 "title": "Model",
15 "type": "string",
16 "description": "Which model to use.",
17 "editor": "textfield",
18 "prefill": "ai-forever/kandinsky-2.2:ea1addaab376f4dc227f5368bbd8eff901820fd1cc14ed8cad63b29249e9d463"
19 },
20 "options": {
21 "title": "Options",
22 "type": "object",
23 "description": "Which options to use.",
24 "editor": "json",
25 "prefill": {
26 "width": 1024,
27 "height": 1024
28 }
29 }
30 },
31 "required": ["prompt", "model"]
32}
src/main.js
1import { Actor } from "apify";
2
3import replicate from "node-replicate";
4
5// this is ESM project, and as such, it requires you to specify extensions in your relative imports
6// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions
7// import { router } from './routes.js';
8
9// The init() call configures the Actor for its environment. It's recommended to start every Actor with an init().
10await Actor.init();
11
12// Structure of input is defined in input_schema.json
13const input = await Actor.getInput();
14const { prompt, model, options } = input
15
16const response = await replicate.run(model, { prompt, ...options })
17
18console.log(response)
19
20// Save headings to Dataset - a table-like storage.
21await Actor.pushData({ response: JSON.parse(JSON.stringify(response)) });
22
23// Gracefully exit the Actor process. It's recommended to quit all Actors with an exit().
24await Actor.exit();
.dockerignore
1# configurations
2.idea
3
4# crawlee and apify storage folders
5apify_storage
6crawlee_storage
7storage
8
9# installed files
10node_modules
11
12# git folder
13.git
.gitignore
1# This file tells Git which files shouldn't be added to source control
2.DS_Store
3.idea
4dist
5node_modules
6apify_storage
7storage/*
8!storage/key_value_stores
9storage/key_value_stores/*
10!storage/key_value_stores/default
11storage/key_value_stores/default/*
12!storage/key_value_stores/default/INPUT.json
package.json
1{
2 "name": "js-scrape-single-page",
3 "version": "0.0.1",
4 "type": "module",
5 "description": "This is an example of an Apify actor.",
6 "engines": {
7 "node": ">=18.0.0"
8 },
9 "dependencies": {
10 "apify": "^3.0.0",
11 "axios": "^1.4.0",
12 "cheerio": "^1.0.0-rc.12",
13 "node-replicate": "^2.0.0"
14
15 },
16 "scripts": {
17 "start": "node ./src/main.js",
18 "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
19 },
20 "author": "It's not you it's me",
21 "license": "ISC"
22}