Skip to content

Instantly share code, notes, and snippets.

@ippan-orc
ippan-orc / imgsize.py
Created May 25, 2025 03:03
アスペクト比と指定ピクセル数から、対応する幅と高さを計算
import math
import argparse
def round_to_64(value):
"""値を64の倍数に四捨五入"""
return max(64, round(value / 64) * 64)
def calc_base_dimensions(width_ratio, height_ratio, target_pixels):
@ippan-orc
ippan-orc / system_prompt.txt
Created May 17, 2025 13:55
image caption system prompt for gemini 2.5
Caption the image in continuous text, covering elements from foreground to background. The caption must be written in English. Refer to the <EXAMPLES> and follow the <STRUCTURE> and <RULES>, <PROHIBIT> below to caption the image.
<RULES>
- Write a image caption in a run of text, like the examples in <EXAMPLES>.
- Include the subject, positional relationship of characters, composition, angle of view, character features, character's clothing, character's actions (also write objects necessary for the action), the state of the background, other objects, and the overall atmosphere.
- If parts are unclear due to overexposure (blown-out highlights), underexposure (crushed blacks), or other reasons, write them only if you are more than 50% confident.
- Write text within the image in the format 'text'. For example, '花'. If the text is Japanese, write it as is in Japanese.
- User can add additional rules and info.
@ippan-orc
ippan-orc / RFB_i2i_pose.json
Created April 28, 2025 02:06
laksjdjf/reference_first_batchでi2i画像を元にポーズ指定するワークフロー。 https://gist.github.com/laksjdjf/5bdb5b8f20bd1ba289704b15f9868680
{
"id": "fb424b49-d22c-4b65-996a-54988d1d0de7",
"revision": 0,
"last_node_id": 85,
"last_link_id": 160,
"nodes": [
{
"id": 7,
"type": "VAEDecode",
"pos": [
#!/bin/bash
# needrestartの設定ファイルに自動再起動設定を追加
# https://gihyo.jp/admin/serial/01/ubuntu-recipe/0718
echo '$nrconf{restart} = '"'a';" | sudo tee -a /etc/needrestart/conf.d/50-autorestart.conf
echo '$nrconf{kernelhints} = '"'0';" | sudo tee -a /etc/needrestart/conf.d/50-autorestart.conf
# システムのパッケージリストを更新し、インストールされているパッケージを最新版にアップグレード
sudo apt update && sudo apt upgrade -y