Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,19 @@ from groq import Groq
|
|
5 |
from prompt_engine import PromptGenerator
|
6 |
from utils import load_techniques, load_styles, parse_prompt_result
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# ページ設定
|
9 |
st.set_page_config(
|
10 |
page_title="AI Art Prompt Generator",
|
@@ -13,6 +26,26 @@ st.set_page_config(
|
|
13 |
initial_sidebar_state="expanded"
|
14 |
)
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
# Groq APIクライアント設定
|
17 |
@st.cache_resource
|
18 |
def get_groq_client():
|
@@ -54,6 +87,52 @@ with st.sidebar:
|
|
54 |
help="生成されるプロンプトの複雑さを調整します"
|
55 |
)
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
st.markdown("---")
|
58 |
|
59 |
st.header("🧙♂️ テクニック設定")
|
@@ -239,6 +318,7 @@ if st.button("🚀 プロンプトを生成", type="primary", use_container_widt
|
|
239 |
"input": user_input,
|
240 |
"mode": mode.lower(),
|
241 |
"complexity": complexity,
|
|
|
242 |
"aspect_ratio": aspect_ratio,
|
243 |
"quality": quality,
|
244 |
"style": style,
|
@@ -291,6 +371,9 @@ if st.button("🚀 プロンプトを生成", type="primary", use_container_widt
|
|
291 |
with col2:
|
292 |
st.caption("MidJourney/nijiJourneyにこのプロンプトを貼り付けて使用してください")
|
293 |
|
|
|
|
|
|
|
294 |
if explanation:
|
295 |
st.markdown("### プロンプト解説")
|
296 |
st.markdown(explanation)
|
|
|
5 |
from prompt_engine import PromptGenerator
|
6 |
from utils import load_techniques, load_styles, parse_prompt_result
|
7 |
|
8 |
+
# モデル特性に基づくカラーテーマ設定
|
9 |
+
model_themes = {
|
10 |
+
"deepseek-r1-distill-llama-70b": {"primary": "#3366cc", "secondary": "#b3c6ff"},
|
11 |
+
"llama-3.3-70b-versatile": {"primary": "#4b367c", "secondary": "#d1c4e9"},
|
12 |
+
"meta-llama/llama-4-maverick-17b-128e-instruct": {"primary": "#00897b", "secondary": "#b2dfdb"},
|
13 |
+
"mistral-saba-24b": {"primary": "#0277bd", "secondary": "#b3e5fc"},
|
14 |
+
"qwen-qwq-32b": {"primary": "#6a1b9a", "secondary": "#e1bee7"}
|
15 |
+
}
|
16 |
+
|
17 |
+
# 選択されたモデル(初回読み込み時のデフォルト値)
|
18 |
+
current_model = "llama-3.3-70b-versatile"
|
19 |
+
theme = model_themes.get(current_model, {"primary": "#4b367c", "secondary": "#d1c4e9"})
|
20 |
+
|
21 |
# ページ設定
|
22 |
st.set_page_config(
|
23 |
page_title="AI Art Prompt Generator",
|
|
|
26 |
initial_sidebar_state="expanded"
|
27 |
)
|
28 |
|
29 |
+
# カスタムCSSの適用
|
30 |
+
st.markdown(f"""
|
31 |
+
<style>
|
32 |
+
.stApp {{
|
33 |
+
background-color: {theme["secondary"]}20; /* 20%の透明度 */
|
34 |
+
}}
|
35 |
+
.stButton>button {{
|
36 |
+
background-color: {theme["primary"]};
|
37 |
+
color: white;
|
38 |
+
}}
|
39 |
+
.stTabs [data-baseweb="tab-list"] {{
|
40 |
+
border-bottom-color: {theme["primary"]}40;
|
41 |
+
}}
|
42 |
+
.stTabs [aria-selected="true"] {{
|
43 |
+
color: {theme["primary"]} !important;
|
44 |
+
border-bottom-color: {theme["primary"]} !important;
|
45 |
+
}}
|
46 |
+
</style>
|
47 |
+
""", unsafe_allow_html=True)
|
48 |
+
|
49 |
# Groq APIクライアント設定
|
50 |
@st.cache_resource
|
51 |
def get_groq_client():
|
|
|
87 |
help="生成されるプロンプトの複雑さを調整します"
|
88 |
)
|
89 |
|
90 |
+
# モデル選択セクションを追加
|
91 |
+
st.markdown("---")
|
92 |
+
st.header("🧠 AIモデル")
|
93 |
+
|
94 |
+
model = st.selectbox(
|
95 |
+
"Groqモデルを選択",
|
96 |
+
[
|
97 |
+
"deepseek-r1-distill-llama-70b",
|
98 |
+
"llama-3.3-70b-versatile",
|
99 |
+
"meta-llama/llama-4-maverick-17b-128e-instruct",
|
100 |
+
"mistral-saba-24b",
|
101 |
+
"qwen-qwq-32b"
|
102 |
+
],
|
103 |
+
index=1, # デフォルトは llama-3.3-70b-versatile
|
104 |
+
help="使用するGroqのAIモデルを選択します。各モデルによって生成結果の特性が異なります"
|
105 |
+
)
|
106 |
+
|
107 |
+
# モデル選択時に変数を更新
|
108 |
+
if model != current_model:
|
109 |
+
current_model = model
|
110 |
+
theme = model_themes.get(current_model, {"primary": "#4b367c", "secondary": "#d1c4e9"})
|
111 |
+
|
112 |
+
# テーマの更新(実際には再読み込みが必要)
|
113 |
+
st.markdown(f"""
|
114 |
+
<style>
|
115 |
+
.stApp {{
|
116 |
+
background-color: {theme["secondary"]}20;
|
117 |
+
}}
|
118 |
+
.stButton>button {{
|
119 |
+
background-color: {theme["primary"]};
|
120 |
+
color: white;
|
121 |
+
}}
|
122 |
+
</style>
|
123 |
+
""", unsafe_allow_html=True)
|
124 |
+
|
125 |
+
# モデル情報の表示
|
126 |
+
model_info = {
|
127 |
+
"deepseek-r1-distill-llama-70b": "DeepSeekのLLaMA 70Bベースモデル。知識と推論能力に優れています。",
|
128 |
+
"llama-3.3-70b-versatile": "Meta AIの最新LLaMA 3.3。バランスの取れた高性能モデルで、多くのタスクに適しています。",
|
129 |
+
"meta-llama/llama-4-maverick-17b-128e-instruct": "LLaMA 4 Maverickの指示チューニング版。小型ながら高性能です。",
|
130 |
+
"mistral-saba-24b": "Mistral AIのSaba 24Bモデル。創造性と一貫性のバランスに優れています。",
|
131 |
+
"qwen-qwq-32b": "Qwen QWQモデル。創造的な表現力が高く、芸術的プロンプトに適しています。"
|
132 |
+
}
|
133 |
+
|
134 |
+
st.caption(model_info.get(model, ""))
|
135 |
+
|
136 |
st.markdown("---")
|
137 |
|
138 |
st.header("🧙♂️ テクニック設定")
|
|
|
318 |
"input": user_input,
|
319 |
"mode": mode.lower(),
|
320 |
"complexity": complexity,
|
321 |
+
"model": model, # 選択されたモデルを追加
|
322 |
"aspect_ratio": aspect_ratio,
|
323 |
"quality": quality,
|
324 |
"style": style,
|
|
|
371 |
with col2:
|
372 |
st.caption("MidJourney/nijiJourneyにこのプロンプトを貼り付けて使用してください")
|
373 |
|
374 |
+
# 使用したモデルの表示を追加
|
375 |
+
st.caption(f"使用モデル: **{model}**")
|
376 |
+
|
377 |
if explanation:
|
378 |
st.markdown("### プロンプト解説")
|
379 |
st.markdown(explanation)
|