Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nishio committed Jan 28, 2025
1 parent bc329a3 commit 7ad6857
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 47 deletions.
36 changes: 23 additions & 13 deletions docs/for_windows_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,31 @@

WindowsユーザはMacやLinuxと比較して環境構築で迷いやすいです。Dockerを使用して比較的マシに環境をセットアップできます。以下の手順に従ってください。

1. **Dockerのインストール**
- Docker Desktopをインストールし、起動します。
### 1. **Dockerのインストール**
Docker Desktopをインストールし、起動します。

2. **Dockerイメージのビルド**
- プロジェクトのルートディレクトリで以下のコマンドを実行してDockerイメージをビルドします。
### 2. **環境変数の設定**
プロジェクトのルートディレクトリで`.env`ファイルを作成します。`.env.example`ファイルをコピーして編集すると良いでしょう。
以下のような内容になります。

```bash
docker build -t broadlistening .
```
```
OPENAI_API_KEY=<your_openai_api_key_here>
```

3. **Dockerコンテナの起動**
- 以下のコマンドを実行してDockerコンテナを起動し、レポートを生成します
### 3. **Dockerイメージのビルド**
プロジェクトのルートディレクトリで以下のコマンドを実行してDockerイメージをビルドします

```bash
docker run -p 8000:8000 broadlistening
```
```bash
docker build -t broadlistening .
```

ブラウザで`http://localhost:8000`を開き、生成されたレポートを確認します。
### 3. **Dockerコンテナの起動**
以下のコマンドを実行してDockerコンテナを起動し、レポートを生成します。

```bash
docker run -p 8000:8000 broadlistening
```


### 4. 結果の確認
ブラウザで`http://localhost:8000`を開き、生成されたレポートを確認します。
Binary file added docs/images/usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 50 additions & 34 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
## 必要なもの

- OpenAIのAPIキー
- PythonとJavaScriptを実行できるマシン

Python 3.10以上が必要です。Pythonのバージョン管理にはpyenvを使用することをお勧めします。

## Windowsユーザ向けDockerセットアップ

Expand All @@ -27,45 +25,63 @@ WindowsユーザはMacやLinuxと比較して環境構築で迷いやすいで

## その他の環境でのセットアップ

1. **Python環境のセットアップ**
- Python 3.10をインストールし、仮想環境を作成してアクティブ化します。
- 必要な依存関係をインストールします。
### **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>
```

```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')"
```
### **レポートの生成**
サンプルの`example-polis`データを使用して試してみましょう。

2. **JavaScript依存関係のインストール**
- npmを使用してJavaScriptの依存関係をインストールします。
```bash
cd pipeline
python main.py configs/example-polis.json
```

```bash
cd next-app
npm install
```
このコマンドは、`pipeline/inputs/example-polis.csv`のデータを使用し、`pipeline/outputs/example-polis/report`にレポートを生成します。

3. **レポートの生成**
- サンプルの`example-polis`データを使用して試してみましょう。
### **レポートの表示**

```bash
cd pipeline
export OPENAI_API_KEY=sk-...
python main.py configs/example-polis.json
```
PythonのHTTPサーバーを使用してレポートを表示します。

このコマンドは、`pipeline/inputs/example-polis.csv`のデータを使用し、`pipeline/outputs/example-polis/report`にレポートを生成します。
```bash
cd pipeline/outputs/example-polis/report
python -m http.server 8000
```

4. **レポートの表示**
ブラウザで`http://localhost:8000`を開きます。

- PythonのHTTPサーバーを使用してレポートを表示します。
### API費用の確認
OpenAIのUsege画面を見るとかかった費用がわかります。

```bash
cd pipeline/outputs/example-polis/report
python -m http.server 8000
```
![](images/usage.png)

ブラウザで`http://localhost:8000`を開きます
この処理では1〜2円程度であることがわかります

0 comments on commit 7ad6857

Please sign in to comment.