Skip to content
misakiotbPublic
forked from code4fukui/img2img

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

img2img APIサーバ

このプロジェクトは、code4fukui/img2img をフォークし、画像変換(img2img)機能をAPIサーバとしてローカルで動かせるようにしたものです。

機能

  • OpenAI GPT-Image-1 APIを利用した画像変換
  • 画像とプロンプトをPOSTすることで変換画像を取得できるAPIサーバ
  • サンプルCLIスクリプトも同梱

セットアップ

  1. このリポジトリをクローン
  2. .env ファイルを作成し、OpenAI APIキーを記入
    OPENAI_API_KEY=あなたのAPIキー
    
  3. 必要な依存(Deno)をインストール

使い方

APIサーバの起動

deno run -A api_server.js

APIエンドポイント

  • POST /api/convert
    • リクエスト例(JSON):
      {
        "prompt": "かわいい線画にして",
        "imagePath": "test/Photo_of_koala_wearing_a_strawberry_hat.png"
      }
    • レスポンス例:
      {
        "data": [
          { "b64_json": "..." }
        ]
      }

curlによるリクエスト例

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "かわいい線画にして",
    "imagePath": "test/Photo_of_koala_wearing_a_strawberry_hat.png"
  }' \
  http://localhost:5000/api/convert

※ レスポンスはbase64エンコード画像データ(b64_json)を含むJSONです。

CLIでの利用

deno run -A img2img.js "かわいい線画にして" test/Photo_of_koala_wearing_a_strawberry_hat.png

テスト

  • test/ ディレクトリにサンプル画像あり
  • 上記のAPIまたはCLIで動作確認してください

ライセンス

  • 元リポジトリのライセンス(LICENSEファイル参照)

参考

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages