-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from takahiroanno2024/quickstart
Add Quickstart
- Loading branch information
Showing
7 changed files
with
164 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
OPENAI_API_KEY= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# ベースイメージとしてPythonとNode.jsを含むイメージを使用 | ||
FROM python:3.10-slim | ||
|
||
# 作業ディレクトリを設定 | ||
WORKDIR /app | ||
|
||
# 必要なシステムパッケージをインストール | ||
RUN apt-get update && apt-get install -y curl gcc build-essential && rm -rf /var/lib/apt/lists/* | ||
|
||
# Node.jsをインストール | ||
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ | ||
&& apt-get install -y nodejs | ||
|
||
# プロジェクトのファイルをコピー | ||
COPY . . | ||
|
||
# Pythonの依存関係をインストール | ||
RUN pip install --no-cache-dir -r scatter/requirements.txt | ||
|
||
# JavaScriptの依存関係をインストール | ||
RUN cd scatter/next-app && npm install | ||
|
||
# NLTKのデータをダウンロード | ||
RUN python -c "import nltk; nltk.download('stopwords')" | ||
|
||
# 環境変数を設定 | ||
ENV OPENAI_API_KEY=your_openai_api_key_here | ||
|
||
# パイプラインを実行し、レポートを生成 | ||
CMD ["bash", "-c", "cd scatter/pipeline && python main.py configs/example-polis.json --skip-interaction && cd outputs/example-polis/report && python -m http.server 8000"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## Windowsユーザ向けDockerセットアップ | ||
(注: このドキュメントは作りかけです) | ||
|
||
|
||
WindowsユーザはMacやLinuxと比較して環境構築で迷いやすいです。Dockerを使用して比較的マシに環境をセットアップできます。以下の手順に従ってください。 | ||
|
||
### 1. **Dockerのインストール** | ||
Docker Desktopをインストールし、起動します。 | ||
|
||
### 2. **環境変数の設定** | ||
プロジェクトのルートディレクトリで`.env`ファイルを作成します。`.env.example`ファイルをコピーして編集すると良いでしょう。 | ||
以下のような内容になります。 | ||
|
||
``` | ||
OPENAI_API_KEY=<your_openai_api_key_here> | ||
``` | ||
|
||
### 3. **Dockerイメージのビルド** | ||
プロジェクトのルートディレクトリで以下のコマンドを実行してDockerイメージをビルドします。 | ||
|
||
```bash | ||
docker build -t broadlistening . | ||
``` | ||
|
||
### 3. **Dockerコンテナの起動** | ||
以下のコマンドを実行してDockerコンテナを起動し、レポートを生成します。 | ||
|
||
```bash | ||
docker run -p 8000:8000 broadlistening | ||
``` | ||
|
||
|
||
### 4. 結果の確認 | ||
ブラウザで`http://localhost:8000`を開き、生成されたレポートを確認します。 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# 初めてのブロードリスニングガイド | ||
|
||
このドキュメントは、初めてブロードリスニングに挑戦する人を想定したガイドです。 | ||
|
||
## 概要 | ||
|
||
このツール(*)は、コメントのCSVファイルを入力として受け取り、以下のようなHTMLレポートを生成するAIパイプラインです。 | ||
|
||
- 元のコメントから主要な議論を抽出 | ||
- 意味的な類似性に基づいて議論をクラスター化 | ||
- 各クラスターにラベルと要約を生成 | ||
- 各クラスター内の議論を探索するためのインタラクティブなマップを提供 | ||
|
||
(* 「このツール」はAI Objective Instituteが開発したTalk to the Cityから派生したものですが、Talk to the Cityにも2種類あり、またかなり大々的に書き換えているため、近々分かりやすい名前をつける予定です) | ||
|
||
## 必要なもの | ||
|
||
- OpenAIのAPIキー | ||
|
||
|
||
## Windowsユーザ向けDockerセットアップ | ||
|
||
WindowsユーザはMacやLinuxと比較して環境構築で迷いやすいです。Dockerを使用して比較的マシに環境をセットアップできます。 | ||
[Windowsユーザ向けDockerセットアップ](for_windows_user.md)を参照。 | ||
|
||
## その他の環境でのセットアップ | ||
|
||
### **Python環境のセットアップ** | ||
|
||
Python 3.10以上が必要です。Pythonのバージョン管理にはpyenvを使用することをお勧めします。 | ||
|
||
Python 3.10をインストールし、仮想環境を作成してアクティブ化します。 | ||
|
||
必要な依存関係をインストールします。 | ||
|
||
```bash | ||
pyenv install 3.10.15 | ||
pyenv local 3.10.15 | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
python -c "import nltk; nltk.download('stopwords')" | ||
``` | ||
|
||
### **JavaScript依存関係のインストール** | ||
npmを使用してJavaScriptの依存関係をインストールします。 | ||
|
||
```bash | ||
cd next-app | ||
npm install | ||
``` | ||
|
||
### **環境変数の設定** | ||
プロジェクトのルートディレクトリで`.env`ファイルを作成します。`.env.example`ファイルをコピーして編集すると良いでしょう。 | ||
以下のような内容になります。 | ||
|
||
``` | ||
OPENAI_API_KEY=<your_openai_api_key_here> | ||
``` | ||
|
||
### **レポートの生成** | ||
サンプルの`example-polis`データを使用して試してみましょう。 | ||
|
||
```bash | ||
cd pipeline | ||
python main.py configs/example-polis.json | ||
``` | ||
|
||
このコマンドは、`pipeline/inputs/example-polis.csv`のデータを使用し、`pipeline/outputs/example-polis/report`にレポートを生成します。 | ||
|
||
### **レポートの表示** | ||
|
||
PythonのHTTPサーバーを使用してレポートを表示します。 | ||
|
||
```bash | ||
cd pipeline/outputs/example-polis/report | ||
python -m http.server 8000 | ||
``` | ||
|
||
ブラウザで`http://localhost:8000`を開きます。 | ||
|
||
### API費用の確認 | ||
OpenAIのUsege画面を見るとかかった費用がわかります。 | ||
|
||
![](images/usage.png) | ||
|
||
この処理では1〜2円程度であることがわかります。 |
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
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