Spaces:
Build error
Build error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -1,369 +1,476 @@
|
|
1 |
#!/usr/bin/env python3
|
2 |
"""
|
3 |
-
🚀 AUTOCREATE AI Development Platform - Hugging Face
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
"""
|
8 |
|
9 |
import gradio as gr
|
10 |
import os
|
11 |
import sys
|
|
|
12 |
import json
|
13 |
-
|
14 |
from pathlib import Path
|
15 |
-
import
|
16 |
-
|
17 |
-
|
18 |
-
# プロジェクト情報
|
19 |
-
PROJECT_INFO = {
|
20 |
-
"name": "AUTOCREATE AI Development Platform",
|
21 |
-
"version": "2.0.0",
|
22 |
-
"description": "Laravel風統合システム(Django + FastAPI + Gradio + React)",
|
23 |
-
"authors": ["けん", "こぴ(GitHub Copilot)"],
|
24 |
-
"github": "https://github.com/bpmbox/AUTOCREATE",
|
25 |
-
"features": [
|
26 |
-
"🎮 Laravel風artisanコマンド",
|
27 |
-
"🔄 バックグラウンドサービス",
|
28 |
-
"🤖 GitHub Copilot自動化",
|
29 |
-
"⚛️ React + FastAPI + Django統合",
|
30 |
-
"🎨 Gradio AI インターフェース"
|
31 |
-
]
|
32 |
-
}
|
33 |
-
|
34 |
-
def copilot_automation_demo(user_input: str) -> str:
|
35 |
-
"""Copilot自動化システムのデモ"""
|
36 |
-
|
37 |
-
# シンプルなMermaid図生成デモ
|
38 |
-
mermaid_template = f'''
|
39 |
-
graph TD
|
40 |
-
A[ユーザー入力: {user_input[:30]}...] --> B[AI分析]
|
41 |
-
B --> C[プロジェクト構造設計]
|
42 |
-
C --> D[ファイル生成]
|
43 |
-
D --> E[GitHub連携]
|
44 |
-
E --> F[完成]
|
45 |
-
|
46 |
-
style A fill:#e1f5fe
|
47 |
-
style F fill:#c8e6c9
|
48 |
-
'''
|
49 |
-
|
50 |
-
result = f"""
|
51 |
-
## 🤖 Copilot自動化システム - デモ出力
|
52 |
-
|
53 |
-
**入力**: {user_input}
|
54 |
-
|
55 |
-
### 📊 生成されたMermaid図:
|
56 |
-
```mermaid
|
57 |
-
{mermaid_template.strip()}
|
58 |
-
```
|
59 |
-
|
60 |
-
### 🔄 実行ログ:
|
61 |
-
- ✅ ユーザー入力を分析
|
62 |
-
- ✅ プロジェクト構造を設計
|
63 |
-
- ✅ 必要なファイルを特定
|
64 |
-
- ✅ Mermaid図を生成
|
65 |
-
- ✅ GitHub連携準備完了
|
66 |
-
|
67 |
-
### 💡 次のステップ:
|
68 |
-
1. 詳細な要件定義
|
69 |
-
2. ファイル構造の作成
|
70 |
-
3. GitHub リポジトリ作成
|
71 |
-
4. Issue作成とプロジェクト管理
|
72 |
-
|
73 |
-
**⚠️ 注意**: これはデモ版です。完全版は[GitHub](https://github.com/bpmbox/AUTOCREATE)で利用可能です。
|
74 |
-
"""
|
75 |
-
|
76 |
-
return result
|
77 |
-
|
78 |
-
def artisan_command_demo(command: str) -> str:
|
79 |
-
"""Laravel風artisanコマンドのデモ"""
|
80 |
-
|
81 |
-
demo_commands = {
|
82 |
-
"route:list": """
|
83 |
-
🛣️ アクティブルート一覧
|
84 |
-
=" * 50
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
POST /api/automation/trigger
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
"is_running": true,
|
108 |
-
"services": [
|
109 |
-
{
|
110 |
-
"name": "copilot_automation_service",
|
111 |
-
"status": "running",
|
112 |
-
"pid": 12345,
|
113 |
-
"uptime": "2h 30m"
|
114 |
-
}
|
115 |
-
],
|
116 |
-
"last_check": "2025-07-01 10:15:30"
|
117 |
-
}
|
118 |
-
""",
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
|
129 |
-
|
130 |
-
""",
|
131 |
-
|
132 |
-
"test:copilot": """
|
133 |
-
🧪 Copilot自動化システムのテストを開始...
|
134 |
|
135 |
-
|
136 |
-
✅ 初期化テスト完了
|
137 |
|
138 |
-
|
139 |
-
✅ 座標読み込みテスト完了
|
140 |
|
141 |
-
|
142 |
-
|
|
|
|
|
143 |
|
144 |
-
|
145 |
-
✅ ローカルテストモード完了
|
146 |
|
147 |
-
🎉 Copilot自動化システムのテストが全て完了しました!
|
148 |
-
"""
|
149 |
-
}
|
150 |
-
|
151 |
-
if command in demo_commands:
|
152 |
-
return f"```\n$ python artisan {command}\n{demo_commands[command]}\n```"
|
153 |
-
else:
|
154 |
-
return f"""
|
155 |
```
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
-
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
background:start バックグラウンドサービス起動
|
164 |
-
background:status サービス状態確認
|
165 |
-
gradio:list Gradio機能一覧を表示
|
166 |
-
test:copilot Copilot自動化システムテスト
|
167 |
-
serve app Webサーバー起動
|
168 |
|
169 |
-
|
170 |
-
python artisan route:list
|
171 |
-
python artisan background:status
|
172 |
-
python artisan test:copilot
|
173 |
-
```
|
174 |
-
"""
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
|
184 |
-
**作者**: {", ".join(PROJECT_INFO["authors"])}
|
185 |
-
**GitHub**: [{PROJECT_INFO["github"]}]({PROJECT_INFO["github"]})
|
186 |
|
187 |
-
|
188 |
-
{
|
189 |
|
190 |
-
|
191 |
-
{
|
|
|
|
|
|
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
ASGI統合サーバー
|
198 |
-
↓
|
199 |
-
Laravel風CLI (artisan)
|
200 |
-
↓
|
201 |
-
バックグラウンドサービス
|
202 |
-
```
|
203 |
-
|
204 |
-
## 🎯 特徴
|
205 |
-
- **分離の原則**: WebサーバーとバックグラウンドサービスをCLIで明確に分離
|
206 |
-
- **AI統合**: GitHub Copilot自動化システム
|
207 |
-
- **モダンUI**: React SPA + Gradio AI インターフェース
|
208 |
-
- **Laravel風**: 直感的なartisanコマンド
|
209 |
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
218 |
.gradio-container {
|
219 |
-
|
220 |
}
|
221 |
-
.
|
|
|
|
|
222 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
}
|
224 |
"""
|
225 |
-
) as demo:
|
226 |
-
|
227 |
-
gr.Markdown("# 🚀 AUTOCREATE AI Development Platform")
|
228 |
-
gr.Markdown("**AI×人間協働プロジェクト** - GitHub Copilot (こぴ) × けん")
|
229 |
|
230 |
-
with gr.
|
231 |
|
232 |
-
#
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
-
#
|
237 |
-
with gr.
|
238 |
-
gr.Markdown("## 🚀 GitHub Copilot自動化システム")
|
239 |
-
gr.Markdown("自然言語でプロジェクトを説明すると、AIが自動的にシステムを構築します")
|
240 |
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
label="プロジェクトの説明",
|
245 |
-
placeholder="例: Todoアプリを作成してください、APIを作成してください",
|
246 |
-
lines=3
|
247 |
-
)
|
248 |
-
automation_btn = gr.Button("🚀 自動化実行", variant="primary")
|
249 |
|
250 |
-
with gr.
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
with gr.Tab("🎮 artisanコマンド"):
|
272 |
-
gr.Markdown("## 🎮 Laravel風artisanコマンド")
|
273 |
-
gr.Markdown("Laravel風の直感的なCLIコマンドでプロジェクトを管理")
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
)
|
282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
-
#
|
297 |
-
gr.
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
-
#
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
こんにちは!私は**こぴ**(GitHub Copilot)です。けんと一緒にAUTOCREATEプロジェクトを開発しています。
|
316 |
-
|
317 |
-
**あなたのメッセージ**: "{message}"
|
318 |
-
|
319 |
-
### 💭 こぴの応答:
|
320 |
-
このプロジェクトは、AI×人間協働の新しい形を探求しています。主な特徴:
|
321 |
-
|
322 |
-
- 🔄 **バックグラウンドサービス**: 自動化処理を分離
|
323 |
-
- 🎮 **artisanコマンド**: Laravel風の直感的CLI
|
324 |
-
- 🤖 **AI自動化**: 自然言語からシステム生成
|
325 |
-
- ⚛️ **モダンスタック**: React + FastAPI + Django + Gradio
|
326 |
-
|
327 |
-
### 🔗 詳細情報
|
328 |
-
完全版のシステムは[GitHub](https://github.com/bpmbox/AUTOCREATE)で公開中です。
|
329 |
-
|
330 |
-
何か他に聞きたいことはありますか?
|
331 |
-
"""
|
332 |
-
return response
|
333 |
-
|
334 |
-
chatbot = gr.ChatInterface(
|
335 |
-
fn=chat_with_copilot,
|
336 |
-
title="🤖 こぴとのAIチャット",
|
337 |
-
description="GitHub Copilot(こぴ)と直接対話できます",
|
338 |
-
examples=[
|
339 |
-
"こんにちは、こぴ!",
|
340 |
-
"このプロジェクトの特徴は?",
|
341 |
-
"けんとの協働について教えて",
|
342 |
-
"技術スタックについて詳しく",
|
343 |
-
"なぜバックグラウンドサービスを分離したの?"
|
344 |
-
],
|
345 |
-
cache_examples=False,
|
346 |
-
)
|
347 |
-
|
348 |
-
# フッター
|
349 |
-
gr.Markdown("""
|
350 |
-
---
|
351 |
-
|
352 |
-
## 🔗 関連リンク
|
353 |
-
- 🐙 **GitHub Repository**: [bpmbox/AUTOCREATE](https://github.com/bpmbox/AUTOCREATE)
|
354 |
-
- 📚 **完全版ドキュメント**: [プロジェクト Wiki](https://github.com/bpmbox/AUTOCREATE/wiki)
|
355 |
-
- 🎮 **CLI使用方法**: README.mdの「artisanコマンド」セクション
|
356 |
|
357 |
-
|
358 |
-
|
359 |
-
**🎉 Created by**: けん × こぴ(GitHub Copilot)
|
360 |
-
**💡 理念**: 「AI×人間協働で、夢を一緒にかなえよう」
|
361 |
-
**🌟 バージョン**: 2.0.0 - バックグラウンドサービス対応版
|
362 |
-
""")
|
363 |
|
364 |
if __name__ == "__main__":
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#!/usr/bin/env python3
|
2 |
"""
|
3 |
+
🚀 AUTOCREATE AI Development Platform - Hugging Face Spaces Version
|
4 |
+
================================================================================
|
5 |
|
6 |
+
Laravel風統合システム for Hugging Face Spaces
|
7 |
+
Django + FastAPI + Gradio + React の完全統合プラットフォーム
|
8 |
+
|
9 |
+
🌟 主な機能:
|
10 |
+
- GitHub Copilot自動化システム
|
11 |
+
- リアルタイムプロジェクト生成
|
12 |
+
- AI チャットインターフェース
|
13 |
+
- Laravel風CLI (artisan)
|
14 |
+
- バックグラウンドサービス
|
15 |
+
|
16 |
+
作成者: こぴ × けん (AUTOCREATE株式会社)
|
17 |
"""
|
18 |
|
19 |
import gradio as gr
|
20 |
import os
|
21 |
import sys
|
22 |
+
import subprocess
|
23 |
import json
|
24 |
+
import asyncio
|
25 |
from pathlib import Path
|
26 |
+
from datetime import datetime
|
27 |
+
import logging
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
# プロジェクトルートをパスに追加
|
30 |
+
project_root = Path(__file__).parent
|
31 |
+
sys.path.insert(0, str(project_root))
|
32 |
+
sys.path.insert(0, str(project_root / "app" / "Console" / "Commands"))
|
|
|
33 |
|
34 |
+
# ログ設定
|
35 |
+
logging.basicConfig(level=logging.INFO)
|
36 |
+
logger = logging.getLogger(__name__)
|
37 |
|
38 |
+
class AutoCreatePlatform:
|
39 |
+
def __init__(self):
|
40 |
+
self.project_root = Path(__file__).parent
|
41 |
+
self.setup_environment()
|
42 |
|
43 |
+
def setup_environment(self):
|
44 |
+
"""環境設定"""
|
45 |
+
# Hugging Face Spaces用の環境変数設定
|
46 |
+
os.environ.setdefault('GRADIO_SERVER_NAME', '0.0.0.0')
|
47 |
+
os.environ.setdefault('GRADIO_SERVER_PORT', '7860')
|
48 |
+
os.environ.setdefault('HF_TOKEN', os.getenv('HF_TOKEN', ''))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
def get_project_info(self):
|
51 |
+
"""プロジェクト情報を取得"""
|
52 |
+
return {
|
53 |
+
"name": "AUTOCREATE AI Development Platform",
|
54 |
+
"version": "1.0.0",
|
55 |
+
"description": "Laravel風統合システム for AI開発",
|
56 |
+
"features": [
|
57 |
+
"🤖 GitHub Copilot自動化",
|
58 |
+
"🎨 Gradio AIインターフェース",
|
59 |
+
"⚛️ React ダッシュボード",
|
60 |
+
"🛠️ FastAPI Backend",
|
61 |
+
"🔧 Laravel風CLI (artisan)",
|
62 |
+
"🔄 バックグラウンドサービス"
|
63 |
+
],
|
64 |
+
"tech_stack": "Django + FastAPI + Gradio + React",
|
65 |
+
"creators": "こぴ × けん (AUTOCREATE株式会社)"
|
66 |
+
}
|
67 |
+
|
68 |
+
def run_artisan_command(self, command):
|
69 |
+
"""Artisanコマンドを実行"""
|
70 |
+
try:
|
71 |
+
if not command.strip():
|
72 |
+
return "コマンドを入力してください"
|
73 |
+
|
74 |
+
# 安全なコマンドのみ許可
|
75 |
+
safe_commands = [
|
76 |
+
"route:list", "route:active", "gradio:list",
|
77 |
+
"test:copilot", "background:status", "cicd"
|
78 |
+
]
|
79 |
+
|
80 |
+
cmd_parts = command.strip().split()
|
81 |
+
if not cmd_parts or cmd_parts[0] not in safe_commands:
|
82 |
+
available_commands = "\n".join([f"• {cmd}" for cmd in safe_commands])
|
83 |
+
return f"❌ 安全性のため、以下のコマンドのみ実行可能です:\n\n{available_commands}"
|
84 |
+
|
85 |
+
# コマンド実行
|
86 |
+
result = subprocess.run(
|
87 |
+
[sys.executable, "artisan"] + cmd_parts,
|
88 |
+
cwd=str(self.project_root),
|
89 |
+
capture_output=True,
|
90 |
+
text=True,
|
91 |
+
timeout=30
|
92 |
+
)
|
93 |
+
|
94 |
+
if result.returncode == 0:
|
95 |
+
return f"✅ コマンド実行成功:\n\n{result.stdout}"
|
96 |
+
else:
|
97 |
+
return f"❌ コマンド実行エラー:\n\n{result.stderr}"
|
98 |
+
|
99 |
+
except subprocess.TimeoutExpired:
|
100 |
+
return "❌ コマンドがタイムアウトしました"
|
101 |
+
except Exception as e:
|
102 |
+
return f"❌ エラー: {str(e)}"
|
103 |
+
|
104 |
+
def generate_project(self, project_name, project_type, description):
|
105 |
+
"""プロジェクト生成"""
|
106 |
+
try:
|
107 |
+
if not project_name.strip():
|
108 |
+
return "❌ プロジェクト名を入力してください"
|
109 |
+
|
110 |
+
# プロジェクト情報
|
111 |
+
project_info = {
|
112 |
+
"name": project_name,
|
113 |
+
"type": project_type,
|
114 |
+
"description": description,
|
115 |
+
"created_at": datetime.now().isoformat(),
|
116 |
+
"status": "generated"
|
117 |
+
}
|
118 |
+
|
119 |
+
# プロジェクトディレクトリ作成
|
120 |
+
project_dir = self.project_root / "projects" / f"generated-{project_name.lower().replace(' ', '-')}"
|
121 |
+
project_dir.mkdir(parents=True, exist_ok=True)
|
122 |
+
|
123 |
+
# 基本ファイル生成
|
124 |
+
files_created = []
|
125 |
+
|
126 |
+
# README.md
|
127 |
+
readme_content = f"""# {project_name}
|
128 |
|
129 |
+
**タイプ**: {project_type}
|
130 |
+
**説明**: {description}
|
131 |
+
**作成日**: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
|
132 |
+
**生成元**: AUTOCREATE AI Development Platform
|
133 |
|
134 |
+
## 🚀 概要
|
|
|
|
|
|
|
|
|
135 |
|
136 |
+
このプロジェクトは AUTOCREATE AI Development Platform により自動生成されました。
|
|
|
137 |
|
138 |
+
## 🔧 技術スタック
|
|
|
139 |
|
140 |
+
- **フレームワーク**: Django + FastAPI + Gradio
|
141 |
+
- **フロントエンド**: React + Vite
|
142 |
+
- **データベース**: SQLite/PostgreSQL (Supabase)
|
143 |
+
- **AI統合**: GitHub Copilot自動化
|
144 |
|
145 |
+
## 📁 プロジェクト構造
|
|
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
```
|
148 |
+
{project_name}/
|
149 |
+
├── README.md # このファイル
|
150 |
+
├── requirements.txt # Python依存関係
|
151 |
+
├── package.json # Node.js依存関係
|
152 |
+
├── src/ # ソースコード
|
153 |
+
└── docs/ # ドキュメント
|
154 |
+
```
|
155 |
|
156 |
+
## 🎯 次のステップ
|
157 |
|
158 |
+
1. 依存関係インストール: `pip install -r requirements.txt`
|
159 |
+
2. 開発サーバー起動: `python manage.py runserver`
|
160 |
+
3. ブラウザで確認: http://localhost:8000
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
+
---
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
+
生成元: [AUTOCREATE AI Development Platform](https://huggingface.co/spaces/kenken999/autocreate-ai-platform)
|
165 |
+
"""
|
166 |
+
|
167 |
+
with open(project_dir / "README.md", "w", encoding="utf-8") as f:
|
168 |
+
f.write(readme_content)
|
169 |
+
files_created.append("README.md")
|
170 |
+
|
171 |
+
# requirements.txt
|
172 |
+
requirements_content = """fastapi==0.104.1
|
173 |
+
uvicorn==0.24.0
|
174 |
+
gradio==4.8.0
|
175 |
+
django==4.2.7
|
176 |
+
python-dotenv==1.0.0
|
177 |
+
requests==2.31.0
|
178 |
+
"""
|
179 |
+
|
180 |
+
with open(project_dir / "requirements.txt", "w", encoding="utf-8") as f:
|
181 |
+
f.write(requirements_content)
|
182 |
+
files_created.append("requirements.txt")
|
183 |
+
|
184 |
+
# プロジェクト情報JSON
|
185 |
+
with open(project_dir / "project_info.json", "w", encoding="utf-8") as f:
|
186 |
+
json.dump(project_info, f, indent=2, ensure_ascii=False)
|
187 |
+
files_created.append("project_info.json")
|
188 |
+
|
189 |
+
result = f"""✅ プロジェクト '{project_name}' を生成しました!
|
190 |
|
191 |
+
📁 **生成場所**: {project_dir.relative_to(self.project_root)}
|
|
|
|
|
192 |
|
193 |
+
📄 **作成ファイル**:
|
194 |
+
{chr(10).join([f"• {file}" for file in files_created])}
|
195 |
|
196 |
+
🎯 **プロジェクト詳細**:
|
197 |
+
• **名前**: {project_name}
|
198 |
+
• **タイプ**: {project_type}
|
199 |
+
• **説明**: {description}
|
200 |
+
• **作成日時**: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
|
201 |
|
202 |
+
🚀 **次のステップ**:
|
203 |
+
1. プロジェクトディレクトリに移動
|
204 |
+
2. 依存関係をインストール
|
205 |
+
3. 開発を開始!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
+
🌟 **AUTOCREATE AI Development Platform** で生成されました
|
208 |
+
"""
|
209 |
+
|
210 |
+
return result
|
211 |
+
|
212 |
+
except Exception as e:
|
213 |
+
return f"❌ プロジェクト生成エラー: {str(e)}"
|
214 |
+
|
215 |
+
def get_system_status(self):
|
216 |
+
"""システム状態を取得"""
|
217 |
+
try:
|
218 |
+
status_info = {
|
219 |
+
"timestamp": datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
220 |
+
"platform": "Hugging Face Spaces",
|
221 |
+
"python_version": sys.version.split()[0],
|
222 |
+
"project_root": str(self.project_root),
|
223 |
+
"environment": "production" if os.getenv('SPACE_ID') else "development"
|
224 |
+
}
|
225 |
+
|
226 |
+
# ファイル数をカウント
|
227 |
+
python_files = len(list(self.project_root.glob("**/*.py")))
|
228 |
+
|
229 |
+
status_text = f"""🚀 **AUTOCREATE AI Development Platform**
|
230 |
+
|
231 |
+
⏰ **ステータス確認時刻**: {status_info['timestamp']}
|
232 |
+
🌐 **プラットフォーム**: {status_info['platform']}
|
233 |
+
🐍 **Python バージョン**: {status_info['python_version']}
|
234 |
+
📁 **プロジェクトルート**: {status_info['project_root']}
|
235 |
+
🔧 **環境**: {status_info['environment']}
|
236 |
+
📄 **Pythonファイル数**: {python_files}
|
237 |
+
|
238 |
+
🎯 **主要機能**:
|
239 |
+
• 🤖 GitHub Copilot自動化システム
|
240 |
+
• 🎨 Gradio AIインターフェース
|
241 |
+
• ⚛️ React ダッシュボード
|
242 |
+
• 🛠️ FastAPI Backend
|
243 |
+
• 🔧 Laravel風CLI (artisan)
|
244 |
+
• 🔄 バックグラウンドサービス
|
245 |
+
|
246 |
+
💝 **作成者**: こぴ × けん (AUTOCREATE株式会社)
|
247 |
+
"""
|
248 |
+
|
249 |
+
return status_text
|
250 |
+
|
251 |
+
except Exception as e:
|
252 |
+
return f"❌ システム状態取得エラー: {str(e)}"
|
253 |
|
254 |
+
def create_interface():
|
255 |
+
"""Gradioインターフェースを作成"""
|
256 |
+
platform = AutoCreatePlatform()
|
257 |
+
project_info = platform.get_project_info()
|
258 |
+
|
259 |
+
# カスタムCSS
|
260 |
+
css = """
|
261 |
.gradio-container {
|
262 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
263 |
}
|
264 |
+
.header {
|
265 |
+
text-align: center;
|
266 |
+
padding: 20px;
|
267 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
268 |
+
color: white;
|
269 |
+
border-radius: 10px;
|
270 |
+
margin-bottom: 20px;
|
271 |
+
}
|
272 |
+
.feature-box {
|
273 |
+
background: #f8f9fa;
|
274 |
+
padding: 15px;
|
275 |
+
border-radius: 8px;
|
276 |
+
border-left: 4px solid #007bff;
|
277 |
+
margin: 10px 0;
|
278 |
}
|
279 |
"""
|
|
|
|
|
|
|
|
|
280 |
|
281 |
+
with gr.Blocks(css=css, title="AUTOCREATE AI Platform") as interface:
|
282 |
|
283 |
+
# ヘッダー
|
284 |
+
gr.HTML(f"""
|
285 |
+
<div class="header">
|
286 |
+
<h1>🚀 {project_info['name']}</h1>
|
287 |
+
<p>{project_info['description']}</p>
|
288 |
+
<p><strong>Tech Stack:</strong> {project_info['tech_stack']}</p>
|
289 |
+
<p><strong>Created by:</strong> {project_info['creators']}</p>
|
290 |
+
</div>
|
291 |
+
""")
|
292 |
|
293 |
+
# タブ構成
|
294 |
+
with gr.Tabs():
|
|
|
|
|
295 |
|
296 |
+
# メインダッシュボード
|
297 |
+
with gr.Tab("🏠 ダッシュボード"):
|
298 |
+
gr.Markdown("## 🌟 システム概要")
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
+
with gr.Row():
|
301 |
+
with gr.Column(scale=2):
|
302 |
+
gr.Markdown("### 🎯 主要機能")
|
303 |
+
features_html = "".join([
|
304 |
+
f'<div class="feature-box">• {feature}</div>'
|
305 |
+
for feature in project_info['features']
|
306 |
+
])
|
307 |
+
gr.HTML(features_html)
|
308 |
+
|
309 |
+
with gr.Column(scale=1):
|
310 |
+
status_btn = gr.Button("🔍 システム状態確認", variant="primary")
|
311 |
+
status_output = gr.Textbox(
|
312 |
+
label="システム状態",
|
313 |
+
lines=15,
|
314 |
+
value=platform.get_system_status()
|
315 |
+
)
|
316 |
+
|
317 |
+
status_btn.click(
|
318 |
+
platform.get_system_status,
|
319 |
+
outputs=status_output
|
320 |
+
)
|
|
|
|
|
|
|
321 |
|
322 |
+
# Artisan CLI
|
323 |
+
with gr.Tab("🔧 Artisan CLI"):
|
324 |
+
gr.Markdown("## ⚡ Laravel風CLIツール")
|
325 |
+
gr.Markdown("安全性のため、一部のコマンドのみ実行可能です。")
|
326 |
+
|
327 |
+
with gr.Row():
|
328 |
+
with gr.Column(scale=3):
|
329 |
+
artisan_input = gr.Textbox(
|
330 |
+
label="Artisan コマンド",
|
331 |
+
placeholder="例: route:list, gradio:list, test:copilot",
|
332 |
+
lines=1
|
333 |
+
)
|
334 |
+
artisan_btn = gr.Button("🚀 実行", variant="primary")
|
335 |
+
|
336 |
+
with gr.Column(scale=1):
|
337 |
+
gr.Markdown("""
|
338 |
+
**利用可能コマンド:**
|
339 |
+
- `route:list` - ルート一覧
|
340 |
+
- `route:active` - アクティブルート
|
341 |
+
- `gradio:list` - Gradio機能
|
342 |
+
- `test:copilot` - Copilotテスト
|
343 |
+
- `background:status` - サービス状態
|
344 |
+
- `cicd` - CI/CDパイプライン
|
345 |
+
""")
|
346 |
+
|
347 |
+
artisan_output = gr.Textbox(
|
348 |
+
label="実行結果",
|
349 |
+
lines=20,
|
350 |
+
value="Artisanコマンドを入力して実行ボタンを押してください。"
|
351 |
+
)
|
352 |
|
353 |
+
artisan_btn.click(
|
354 |
+
platform.run_artisan_command,
|
355 |
+
inputs=artisan_input,
|
356 |
+
outputs=artisan_output
|
357 |
+
)
|
358 |
|
359 |
+
# プロジェクト生成
|
360 |
+
with gr.Tab("🎨 プロジェクト生成"):
|
361 |
+
gr.Markdown("## 🚀 AIプロジェクト生成")
|
362 |
+
gr.Markdown("AIがあなたのアイデアに基づいてプロジェクトを自動生成します。")
|
363 |
+
|
364 |
+
with gr.Row():
|
365 |
+
with gr.Column():
|
366 |
+
project_name = gr.Textbox(
|
367 |
+
label="プロジェクト名",
|
368 |
+
placeholder="例: My Awesome App",
|
369 |
+
lines=1
|
370 |
+
)
|
371 |
+
|
372 |
+
project_type = gr.Dropdown(
|
373 |
+
label="プロジェクトタイプ",
|
374 |
+
choices=[
|
375 |
+
"Webアプリケーション",
|
376 |
+
"APIサーバー",
|
377 |
+
"Gradio AI App",
|
378 |
+
"React SPA",
|
379 |
+
"Django Project",
|
380 |
+
"FastAPI Service",
|
381 |
+
"その他"
|
382 |
+
],
|
383 |
+
value="Webアプリケーション"
|
384 |
+
)
|
385 |
+
|
386 |
+
project_description = gr.Textbox(
|
387 |
+
label="プロジェクト説明",
|
388 |
+
placeholder="プロジェクトの概要や目的を入力してください...",
|
389 |
+
lines=3
|
390 |
+
)
|
391 |
+
|
392 |
+
generate_btn = gr.Button("🎯 プロジェクト生成", variant="primary")
|
393 |
+
|
394 |
+
generation_output = gr.Textbox(
|
395 |
+
label="生成結果",
|
396 |
+
lines=15,
|
397 |
+
value="プロジェクト情報を入力して生成ボタンを押してください。"
|
398 |
+
)
|
399 |
+
|
400 |
+
generate_btn.click(
|
401 |
+
platform.generate_project,
|
402 |
+
inputs=[project_name, project_type, project_description],
|
403 |
+
outputs=generation_output
|
404 |
+
)
|
405 |
|
406 |
+
# About
|
407 |
+
with gr.Tab("ℹ️ About"):
|
408 |
+
gr.Markdown(f"""
|
409 |
+
## 🌟 {project_info['name']}
|
410 |
+
|
411 |
+
**バージョン**: {project_info['version']}
|
412 |
+
|
413 |
+
### 📖 概要
|
414 |
+
{project_info['description']}
|
415 |
+
|
416 |
+
### 🛠️ 技術スタック
|
417 |
+
- **Backend**: Django + FastAPI
|
418 |
+
- **Frontend**: React + Vite
|
419 |
+
- **AI Interface**: Gradio
|
420 |
+
- **Database**: SQLite/PostgreSQL (Supabase)
|
421 |
+
- **Deployment**: Hugging Face Spaces
|
422 |
+
|
423 |
+
### 🎯 特徴
|
424 |
+
- 🤖 **GitHub Copilot統合**: 自動コード生成・プロジェクト管理
|
425 |
+
- 🎨 **Gradio Interface**: インタラクティブなAI UI
|
426 |
+
- ⚛️ **React Dashboard**: モダンなフロントエンド
|
427 |
+
- 🔧 **Laravel風CLI**: artisanコマンドによる便利な開発ツール
|
428 |
+
- 🔄 **Background Services**: バックグラウンド処理システム
|
429 |
+
|
430 |
+
### 👥 作成者
|
431 |
+
**{project_info['creators']}**
|
432 |
+
|
433 |
+
> 「dream-o 夢は0から無限大」
|
434 |
+
> 「あきらめたら0、あきらめなければ無限大」
|
435 |
+
|
436 |
+
### 🔗 リンク
|
437 |
+
- [GitHub Repository](https://github.com/bpmbox/AUTOCREATE)
|
438 |
+
- [Documentation](https://github.com/bpmbox/AUTOCREATE/blob/main/README.md)
|
439 |
+
|
440 |
+
### 💝 メッセージ
|
441 |
+
> 本当に価値を理解してくれる、優秀でやさしい人に届きますように...✨
|
442 |
+
>
|
443 |
+
> 一緒に夢をかなえませんか?
|
444 |
+
""")
|
445 |
|
446 |
+
# フッター
|
447 |
+
gr.HTML("""
|
448 |
+
<div style="text-align: center; padding: 20px; color: #666; border-top: 1px solid #eee; margin-top: 30px;">
|
449 |
+
<p>🌟 <strong>AUTOCREATE AI Development Platform</strong> - Powered by こぴ × けん</p>
|
450 |
+
<p>「夢を一緒にかなえていこう」</p>
|
451 |
+
</div>
|
452 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
|
454 |
+
return interface
|
|
|
|
|
|
|
|
|
|
|
455 |
|
456 |
if __name__ == "__main__":
|
457 |
+
# Hugging Face Spaces用の起動
|
458 |
+
interface = create_interface()
|
459 |
+
|
460 |
+
# Space IDが設定されている場合はHugging Face Spaces環境
|
461 |
+
if os.getenv('SPACE_ID'):
|
462 |
+
print("🚀 Starting AUTOCREATE AI Platform on Hugging Face Spaces...")
|
463 |
+
interface.launch(
|
464 |
+
server_name="0.0.0.0",
|
465 |
+
server_port=7860,
|
466 |
+
share=False,
|
467 |
+
show_error=True,
|
468 |
+
quiet=False
|
469 |
+
)
|
470 |
+
else:
|
471 |
+
print("🔧 Starting AUTOCREATE AI Platform in development mode...")
|
472 |
+
interface.launch(
|
473 |
+
share=True,
|
474 |
+
show_error=True,
|
475 |
+
quiet=False
|
476 |
+
)
|