{"id":28496215,"url":"https://github.com/masanori0209/multi-modal-sample","last_synced_at":"2026-04-19T19:33:22.476Z","repository":{"id":297922275,"uuid":"998300626","full_name":"masanori0209/multi-modal-sample","owner":"masanori0209","description":"ファイルからテキストと画像を抽出し、AIを活用したマルチモーダルな対話型アプリケーション","archived":false,"fork":false,"pushed_at":"2025-06-11T12:30:46.000Z","size":1456,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-02T15:42:47.922Z","etag":null,"topics":["langchain","llama-index","postgresql","python","streamlit"],"latest_commit_sha":null,"homepage":"https://zenn.dev/m2lab/articles/b5d0e283f9b68b","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/masanori0209.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-08T10:11:17.000Z","updated_at":"2025-06-11T12:30:42.000Z","dependencies_parsed_at":"2025-06-08T11:36:48.333Z","dependency_job_id":null,"html_url":"https://github.com/masanori0209/multi-modal-sample","commit_stats":null,"previous_names":["masanori0209/multi-modal-sample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/masanori0209/multi-modal-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masanori0209%2Fmulti-modal-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masanori0209%2Fmulti-modal-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masanori0209%2Fmulti-modal-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masanori0209%2Fmulti-modal-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masanori0209","download_url":"https://codeload.github.com/masanori0209/multi-modal-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masanori0209%2Fmulti-modal-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32020666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["langchain","llama-index","postgresql","python","streamlit"],"created_at":"2025-06-08T12:06:44.345Z","updated_at":"2026-04-19T19:33:22.453Z","avatar_url":"https://github.com/masanori0209.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multi-Modal Sample Chat Application\n\n![Sample](sample/sample-image.png)\n\nPDF、Word、Excel、画像ファイルをアップロードして、テキスト検索と画像認識を組み合わせた対話型アプリケーションです。\n\n## 機能\n\n- 複数フォーマット対応のファイルアップロード\n  - PDFファイル\n  - Wordファイル（.docx, .doc）\n  - Excelファイル（.xlsx, .xls）\n  - 画像ファイル（.png, .jpg, .jpeg）\n- ファイルからのテキスト抽出\n  - PDF: テキストと画像の抽出\n  - Word: テキスト、テーブル、ヘッダー、フッター、画像内テキストの抽出\n  - Excel: テーブルデータの抽出\n  - 画像: OCRによるテキスト抽出\n- PostgreSQL + pgvectorを使用した効率的なベクトル検索\n- GPT-4を活用した対話型質問応答\n- データベース管理機能\n  - データベースサイズの表示\n  - テーブル情報の表示\n  - ベクトルストアのクリア機能\n- Streamlitベースの使いやすいUI\n  - カスタマイズ可能なプロンプト設定\n  - セッション管理機能\n\n## 技術スタック\n\n- Python 3.11\n- Streamlit: Web UI\n- LlamaIndex: ベクトル検索とエージェント\n- OpenAI GPT-4: 対話エンジン\n- PostgreSQL + pgvector: ベクトルデータベース\n- Docker: コンテナ化\n\n## 必要条件\n\n- Python 3.11以上\n- Docker\n- Docker Compose\n- OpenAI API Key\n\n## セットアップ\n\n1. リポジトリをクローン:\n```bash\ngit clone [repository-url]\ncd multi-modal-app\n```\n\n2. 環境変数の設定:\n`.env`ファイルを作成し、以下の環境変数を設定:\n```\nOPENAI_API_KEY=your_api_key\nPG_HOST=localhost\nPG_PORT=5432\nPG_DATABASE=ragdb\nPG_USER=raguser\nPG_PASSWORD=ragpass\nCUSTOM_PROMPT=画像から項目とデータに分けて出力してください\nSYSTEM_PROMPT=ドキュメント検索エンジンからデータを取得して回答してください\n```\n\n3. Docker Composeで起動:\n```bash\ndocker-compose up --build\n```\n\n## 使用方法\n\n1. アプリケーションにアクセス:\n   - ブラウザで `http://localhost:8501` にアクセス\n\n2. ファイルのアップロード:\n   - サポートされている形式（PDF、Word、Excel、画像）のファイルを選択\n   - アップロード後、自動的にテキスト抽出とインデックス登録が実行されます\n\n3. 質問:\n   - テキストボックスに質問を入力\n   - 「質問する」ボタンをクリック\n\n4. 設定（サイドバー）\n   - OpenAI API Key: APIキーの設定\n   - Model選択（gpt-4.1-mini, gpt-4o-miniのみ）\n   - 画像読み込み時プロンプト: 画像処理時の指示を設定\n   - システムプロンプト: 回答の出力形式を指定\n   - データベース情報: 現在のデータベースサイズとテーブル情報を表示\n   - セッションリセット: 現在のセッションをクリア\n   - ベクトルストアクリア: 保存されたデータを削除\n\n## プロジェクト構造\n\n```\nmulti-modal-sample/\n├── app/                    # アプリケーションのメインコード\n│   ├── __init__.py         # Pythonパッケージ定義\n│   ├── config.py           # 設定ファイル（APIキー、DB設定など）\n│   ├── db.py              # データベース操作\n│   ├── Dockerfile         # アプリケーション用Dockerfile\n│   ├── main.py            # アプリケーションのエントリーポイント\n│   ├── pyproject.toml     # Pythonプロジェクト設定\n│   ├── ui.py              # Streamlit UIの実装\n│   └── utils.py           # ユーティリティ関数（ファイル処理、画像処理など）\n├── docker-compose.yml     # Docker Compose設定\n├── .gitignore            # Git除外設定\n└── README.md             # プロジェクトドキュメント\n```\n\n### 主要コンポーネント\n\n- `app/config.py`: アプリケーションの設定管理（OpenAI API、データベース接続、エージェント設定）\n- `app/db.py`: PostgreSQLデータベース操作（サイズ取得、テーブル情報、クリア機能）\n- `app/ui.py`: Streamlitベースのユーザーインターフェース実装\n- `app/utils.py`: 各種ファイル形式の処理、テキスト抽出、画像処理\n- `app/main.py`: アプリケーションのメインエントリーポイント\n- `docker-compose.yml`: PostgreSQLとpgvectorを含む開発環境の設定\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasanori0209%2Fmulti-modal-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasanori0209%2Fmulti-modal-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasanori0209%2Fmulti-modal-sample/lists"}