This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ■こちらのYouTube動画で作成したコードです | |
# https://www.youtube.com/watch?v=qBQ7MNPDq7I | |
# | |
# ■下記のコードを写経しながら、スクレイピングについて学習した際のコードとなります | |
# https://gist.github.com/genekogan/ebd77196e4bf0705db51f86431099e57#gistcomment-3465381 | |
# | |
# コードの実行には下記のインストールが必要です | |
# Selenium, chromedriver-binary | |
from selenium import webdriver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
from datetime import datetime, timedelta | |
import time | |
WP_URL = "<WordPressのURL>" | |
WP_USER = "<投稿ユーザのユーザ名>" | |
WP_PASS = "<WP REST APIで設定されたパスワード>" | |
for i in range(5): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require('readline'); | |
const { Configuration, OpenAIApi } = require('openai'); | |
(async () => { | |
const configuration = new Configuration({ | |
apiKey: process.env.OPENAI_API_KEY, | |
}); | |
const openai = new OpenAIApi(configuration); | |
const rl = readline.createInterface({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChangeEvent, useRef, useState } from 'react'; | |
import Head from 'next/head' | |
import styles from '@/styles/Home.module.css' | |
// ChatGPT APIとのやり取りに利用 | |
const messages: Array<any> = []; | |
export default function Home() { | |
// 入力用 | |
const [inputValue, setInputValue] = useState(''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stable Diffusion web UIのリポジトリをクローンして、クローンしたフォルダに移動 | |
!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui | |
%cd /content/stable-diffusion-webui | |
# v1.1.1を利用する | |
!git checkout tags/v1.1.1 | |
# pytorch関連のライブラリをv1.1.1向けにバージョンを固定してインストール | |
!pip3 install torchvision==0.15.1 torch==2.0.0 torchtext==0.15.1 torchdata==0.6.0 torchaudio==2.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ControlNetをインストールした状態でweb UIを実行すると"ERROR: Failed building wheel for pycairo"というエラーが出るため、以下のコマンドをまずは実施 | |
!apt -y install -qq aria2 libcairo2-dev pkg-config python3-dev | |
# ControlNet 1.1のダウンロード | |
!git clone https://github.com/Mikubill/sd-webui-controlnet /content/stable-diffusion-webui/extensions/sd-webui-controlnet | |
# modelファイルのダウンロード | |
!curl -Lo /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11e_sd15_ip2p.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p.pth | |
!curl -Lo /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11e_sd15_shuffle.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle.pth | |
!curl -Lo /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11f1e_sd15_tile.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile.pth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EasyNegativeのダウンロード | |
!wget https://huggingface.co/datasets/gsdf/EasyNegative/resolve/main/EasyNegative.safetensors --directory-prefix=/content/stable-diffusion-webui/embeddings/ | |
# LoRAのダウンロード(注意:ダウンロード先がCivitai前提のコードになっています) | |
!wget {ここにダウンロードしたいLoRAのダウンロードURLを入れてください} --content-disposition --directory-prefix=/content/stable-diffusion-webui/models/Lora/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EasyNegativeのダウンロード | |
!wget https://huggingface.co/datasets/gsdf/EasyNegative/resolve/main/EasyNegative.safetensors --directory-prefix=/content/stable-diffusion-webui/embeddings/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LoRAのダウンロード(ダウンロード先:Hugging Face) | |
!wget {ここにダウンロードしたいLoRAのダウンロードURLを入れてください} --directory-prefix=/content/stable-diffusion-webui/models/Lora/ | |
# LoRAのダウンロード(ダウンロード先:Civitai) | |
!wget {ここにダウンロードしたいLoRAのダウンロードURLを入れてください} --content-disposition --directory-prefix=/content/stable-diffusion-webui/models/Lora/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# モデルファイルのダウンロード(ダウンロード先:Hugging Face) | |
!wget {ここにダウンロードしたいモデルのダウンロードURLを入れてください} --directory-prefix=/content/stable-diffusion-webui/models/Stable-diffusion/ | |
# モデルファイルのダウンロード(ダウンロード先:Civitai) | |
!wget {ここにダウンロードしたいモデルのダウンロードURLを入れてください} --content-disposition --directory-prefix=/content/stable-diffusion-webui/models/Stable-diffusion/ |
OlderNewer