Skip to content

Commit c0efc95

Browse files
committed
Implement Streamlit UI for JAXA Earth API MCP functionality, including a new launch script and enhanced README documentation. Update dependencies to include Streamlit and Matplotlib, and fix image handling in heightmap generation.
1 parent 405bf04 commit c0efc95

7 files changed

Lines changed: 1038 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ JAXA Earth APIの地球観測データを、**Blender/Unity/VRChat**で使える
1111

1212
📖 **[詳細なセットアップガイド(GitHub Pages)](https://zapabob.github.io/jaxa-earth-vrchat-terrain/)** - Apple風デザインの日英併記ドキュメント
1313

14+
🖥️ **Streamlit UI**: Appleデザインの自然言語インターフェースでMCP機能を実行できます。詳細は[STREAMLIT_README.md](STREAMLIT_README.md)を参照してください。
15+
1416
## ✨ 何ができる?
1517

1618
- 🛰️ **JAXAの衛星データを取得** - 標高、地表面温度、植生指数など様々なデータにアクセス

STREAMLIT_README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Streamlit UI - JAXA Earth API MCP Interface
2+
3+
Appleデザインの自然言語インターフェースで、JAXA Earth APIのMCP機能を実行できます。
4+
5+
## 機能
6+
7+
- 🌍 **自然言語入力**: 日本語または英語でリクエストを入力
8+
- 🔍 **コレクション検索**: キーワードでデータセットを検索
9+
- 🖼️ **画像取得**: 衛星画像を取得して表示
10+
- 📊 **空間統計**: データの統計情報を計算
11+
- 🗺️ **高度マップ生成**: 3D地形用の高度マップを生成
12+
- 📝 **計画作成**: タスクの実装計画を作成
13+
14+
## セットアップ
15+
16+
### 1. 依存関係のインストール
17+
18+
```bash
19+
cd jaxa-earth-mcp
20+
uv sync
21+
```
22+
23+
### 2. Streamlitアプリの起動
24+
25+
```bash
26+
# 方法1: 直接起動
27+
uv run streamlit run streamlit_app.py
28+
29+
# 方法2: 起動スクリプトを使用
30+
uv run python run_streamlit.py
31+
```
32+
33+
### 3. ブラウザでアクセス
34+
35+
アプリが起動すると、自動的にブラウザが開きます。開かない場合は、以下のURLにアクセスしてください:
36+
37+
```
38+
http://localhost:8501
39+
```
40+
41+
## 使い方
42+
43+
### 基本的な使い方
44+
45+
1. **自然言語でリクエストを入力**
46+
- 例: "富士山周辺の標高データを取得して、高度マップを生成してください"
47+
- 例: "温度データを検索してください"
48+
- 例: "関東地方の衛星画像を表示してください"
49+
50+
2. **実行ボタンをクリック**
51+
- 自動的に適切なMCPツールが選択され、実行されます
52+
53+
3. **結果を確認**
54+
- 画像、統計情報、グラフなどが表示されます
55+
56+
### 利用可能な機能
57+
58+
#### コレクション検索
59+
```
60+
"温度データを検索"
61+
"LSTデータを探す"
62+
"標高データのコレクションを検索"
63+
```
64+
65+
#### 画像取得
66+
```
67+
"富士山周辺の衛星画像を表示"
68+
"関東地方の標高データを取得"
69+
```
70+
71+
#### 空間統計
72+
```
73+
"富士山周辺の標高統計を計算"
74+
"温度データの統計情報を取得"
75+
```
76+
77+
#### 高度マップ生成
78+
```
79+
"富士山周辺の高度マップを生成"
80+
"地形データから高度マップを作成"
81+
```
82+
83+
## Appleデザイン
84+
85+
- ミニマルで美しいUI
86+
- スムーズなアニメーション
87+
- レスポンシブデザイン
88+
- 直感的な操作
89+
90+
## トラブルシューティング
91+
92+
### エラー: 必要なライブラリのインポートに失敗
93+
94+
依存関係がインストールされていない可能性があります:
95+
96+
```bash
97+
uv sync
98+
```
99+
100+
### エラー: MCPサーバーの関数が見つからない
101+
102+
`mcp_server.py`が同じディレクトリにあることを確認してください。
103+
104+
### ポートが既に使用されている
105+
106+
別のポートで起動:
107+
108+
```bash
109+
uv run streamlit run streamlit_app.py --server.port=8502
110+
```
111+
112+
## 開発
113+
114+
### カスタマイズ
115+
116+
`streamlit_app.py`を編集して、UIや機能をカスタマイズできます。
117+
118+
### 新しい機能の追加
119+
120+
1. `mcp_server.py`に新しいMCPツールを追加
121+
2. `streamlit_app.py``execute_natural_language_request`関数を更新
122+
3. 必要に応じて表示関数を追加
123+
124+
## ライセンス
125+
126+
MIT License

mcp_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def generate_heightmap(
518518

519519
# PNG形式で保存(16bitグレースケール)
520520
height_uint16 = (height_normalized * 65535).astype(np.uint16)
521-
height_image = Image.fromarray(height_uint16, mode='I;16')
521+
height_image = PILImage.fromarray(height_uint16, mode='I;16')
522522
height_image.save(output_path)
523523

524524
return {

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ dependencies = [
2525
"Pillow>=10.0.0",
2626
"scipy>=1.11.0",
2727
"jaxa-earth>=0.1.5",
28+
"streamlit>=1.28.0", # Streamlit UI
29+
"matplotlib>=3.8.0", # グラフ可視化
2830
]
2931

3032
[[tool.uv.index]]

run_streamlit.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Streamlitアプリの起動スクリプト
4+
"""
5+
6+
import subprocess
7+
import sys
8+
from pathlib import Path
9+
10+
if __name__ == "__main__":
11+
streamlit_app_path = Path(__file__).parent / "streamlit_app.py"
12+
13+
# Streamlitを起動
14+
subprocess.run([
15+
sys.executable,
16+
"-m", "streamlit", "run",
17+
str(streamlit_app_path),
18+
"--server.port=8501",
19+
"--server.address=localhost"
20+
])

0 commit comments

Comments
 (0)