Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,61 +5,61 @@ import random
|
|
5 |
# Set page configuration
|
6 |
st.set_page_config(page_title="ChatGPT Prompt Generator", page_icon="🧠", layout="wide")
|
7 |
|
8 |
-
# Custom CSS for
|
9 |
st.markdown("""
|
10 |
<style>
|
11 |
.main {background-color: #f8f9fa;}
|
12 |
.stButton button {
|
13 |
-
border-radius:
|
14 |
-
padding:
|
15 |
-
font-size: 0.
|
16 |
display: inline-flex;
|
17 |
align-items: center;
|
18 |
margin: 1px;
|
19 |
min-height: 0px;
|
|
|
20 |
}
|
21 |
.stButton button:hover {background-color: #e9ecef;}
|
22 |
-
div[data-testid="stVerticalBlock"] {gap: 0.
|
23 |
-
div[data-testid="stHorizontalBlock"] {gap: 0.
|
24 |
.stTextArea textarea, .stTextInput input {
|
25 |
-
padding: 0.
|
26 |
-
font-size: 0.
|
27 |
min-height: 0px;
|
28 |
}
|
29 |
div[data-testid="stForm"] {border-width: 0px; padding: 0rem 0rem;}
|
30 |
.row-widget.stRadio > div {flex-direction: row;}
|
31 |
-
.row-widget.stRadio > div > label {margin: 0px 0.
|
32 |
-
h1, h2, h3 {margin-top: 0; margin-bottom: 0.
|
33 |
-
|
34 |
-
|
35 |
-
.grid-container {
|
36 |
display: grid;
|
37 |
-
grid-template-columns: repeat(
|
38 |
gap: 2px;
|
39 |
}
|
40 |
-
.grid-item {margin: 0px;}
|
41 |
.section-header {
|
42 |
font-weight: bold;
|
43 |
-
font-size:
|
44 |
-
margin-bottom: 0.
|
45 |
-
margin-top: 0.
|
|
|
46 |
}
|
47 |
.prompt-display {
|
48 |
background-color: #ffffff;
|
49 |
-
border-radius:
|
50 |
-
padding:
|
51 |
border: 1px solid #e9ecef;
|
52 |
-
min-height:
|
53 |
-
font-size: 0.
|
54 |
white-space: pre-wrap;
|
55 |
}
|
56 |
.sample-prompt {
|
57 |
-
font-size: 0.
|
58 |
-
padding:
|
59 |
-
border-radius:
|
60 |
-
margin-bottom:
|
61 |
}
|
62 |
-
.emoji {font-size:
|
63 |
</style>
|
64 |
""", unsafe_allow_html=True)
|
65 |
|
@@ -81,7 +81,9 @@ data = {
|
|
81 |
{"name": "Life Coach", "emoji": "🧘"}, {"name": "Data Analyst", "emoji": "📈"},
|
82 |
{"name": "Influencer", "emoji": "📱"}, {"name": "Language Tutor", "emoji": "🗣️"},
|
83 |
{"name": "Fitness Trainer", "emoji": "💪"}, {"name": "Teacher", "emoji": "👨🏫"},
|
84 |
-
{"name": "Therapist", "emoji": "🧐"}, {"name": "Detective", "emoji": "🔍"}
|
|
|
|
|
85 |
],
|
86 |
'tones': [
|
87 |
{"name": "Informative", "emoji": "ℹ️"}, {"name": "Inspirational", "emoji": "✨"},
|
@@ -89,7 +91,9 @@ data = {
|
|
89 |
{"name": "Professional", "emoji": "👔"}, {"name": "Casual", "emoji": "👋"},
|
90 |
{"name": "Persuasive", "emoji": "🤝"}, {"name": "Encouraging", "emoji": "🙌"},
|
91 |
{"name": "Empathetic", "emoji": "🤗"}, {"name": "Serious", "emoji": "😐"},
|
92 |
-
{"name": "Enthusiastic", "emoji": "🤩"}, {"name": "Thoughtful", "emoji": "💭"}
|
|
|
|
|
93 |
],
|
94 |
'instructions': [
|
95 |
{"name": "Create", "emoji": "🔨"}, {"name": "Suggest", "emoji": "💡"},
|
@@ -97,10 +101,13 @@ data = {
|
|
97 |
{"name": "Analyze", "emoji": "🔍"}, {"name": "Explain", "emoji": "📚"},
|
98 |
{"name": "Describe", "emoji": "🔎"}, {"name": "Summarize", "emoji": "📋"},
|
99 |
{"name": "Compare", "emoji": "⚖️"}, {"name": "Outline", "emoji": "📋"},
|
100 |
-
{"name": "Evaluate", "emoji": "⭐"}, {"name": "List", "emoji": "📋"}
|
|
|
|
|
101 |
],
|
102 |
'lengths': [
|
103 |
-
{"name": "
|
|
|
104 |
{"name": "Short", "emoji": "🩳"}, {"name": "Medium", "emoji": "📊"},
|
105 |
{"name": "Long", "emoji": "📜"}, {"name": "Brief", "emoji": "💨"},
|
106 |
{"name": "Detailed", "emoji": "🔎"}, {"name": "Comprehensive", "emoji": "📚"}
|
@@ -111,34 +118,31 @@ data = {
|
|
111 |
{"name": "Summary", "emoji": "📋"}, {"name": "Story", "emoji": "📖"},
|
112 |
{"name": "Essay", "emoji": "📄"}, {"name": "Review", "emoji": "⭐"},
|
113 |
{"name": "Tutorial", "emoji": "👨🏫"}, {"name": "Report", "emoji": "📊"},
|
114 |
-
{"name": "Plan", "emoji": "📆"}, {"name": "Script", "emoji": "🎬"}
|
|
|
|
|
115 |
],
|
116 |
'audiences': [
|
117 |
{"name": "Beginners", "emoji": "🌱"}, {"name": "Experts", "emoji": "🧠"},
|
118 |
{"name": "Students", "emoji": "🎓"}, {"name": "Professionals", "emoji": "👔"},
|
119 |
{"name": "Business Owners", "emoji": "💼"}, {"name": "General Public", "emoji": "👥"},
|
120 |
-
{"name": "Developers", "emoji": "💻"}, {"name": "Children", "emoji": "👶"}
|
|
|
|
|
121 |
],
|
122 |
'formats': [
|
123 |
{"name": "Markdown", "emoji": "📝"}, {"name": "HTML", "emoji": "🌐"},
|
124 |
{"name": "Plain Text", "emoji": "📄"}, {"name": "JSON", "emoji": "🔄"},
|
125 |
-
{"name": "PDF", "emoji": "📑"}, {"name": "Python
|
126 |
-
{"name": "JavaScript", "emoji": "📜"}, {"name": "SQL
|
|
|
127 |
]
|
128 |
}
|
129 |
|
130 |
-
#
|
131 |
-
|
132 |
-
{"title": "👨🏫 Teaching", "color": "#e6f3ff", "border": "#b8daff",
|
133 |
-
"prompt": "Act as a 👨🏫 Teacher, use 📚 Informative tone, Create a 📋 Guide for 🌱 Beginners.\n\nIt should be about Git version control.\nInclude practical examples.\nExclude advanced techniques.\n\nReturn as 📝 Markdown."},
|
134 |
-
{"title": "💼 Business", "color": "#e6ffed", "border": "#b8e6cc",
|
135 |
-
"prompt": "Act as a 👔 Professional, use 🤝 Persuasive tone, Write a 📧 Email for 👩💼 Executives.\n\nIt should be about a product launch.\nInclude ROI metrics.\nExclude technical details.\n\nReturn as 📄 Plain Text."}
|
136 |
-
]
|
137 |
-
|
138 |
-
# Function to create buttons for a category
|
139 |
-
def create_category_buttons(category_name, items, col_count=4):
|
140 |
st.markdown(f"<div class='section-header'>{category_name}</div>", unsafe_allow_html=True)
|
141 |
-
st.markdown("<div class='grid-container'>", unsafe_allow_html=True)
|
142 |
|
143 |
for i, item in enumerate(items):
|
144 |
key = f"{category_name.lower().replace(' ', '_')}_{i}"
|
@@ -146,125 +150,155 @@ def create_category_buttons(category_name, items, col_count=4):
|
|
146 |
button_type = "primary" if is_selected else "secondary"
|
147 |
|
148 |
if st.button(f"{item['emoji']} {item['name']}", key=key, help=f"Select {item['name']}",
|
149 |
-
type=button_type, use_container_width=
|
150 |
st.session_state.selections[category_name.lower().replace(' ', '_')] = item
|
151 |
st.experimental_rerun()
|
152 |
|
153 |
st.markdown("</div>", unsafe_allow_html=True)
|
154 |
|
155 |
-
#
|
156 |
-
st.markdown("<h2 style='text-align: center;'><span class='emoji'>🧠</span> ChatGPT Prompt Generator</h2>", unsafe_allow_html=True)
|
157 |
|
158 |
-
# Main layout with
|
159 |
-
|
160 |
|
161 |
-
with
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
-
with
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
create_category_buttons("Length", data['lengths'])
|
170 |
-
create_category_buttons("Content Type", data['content_types'])
|
171 |
-
create_category_buttons("Audience", data['audiences'])
|
172 |
-
create_category_buttons("Format", data['formats'])
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
|
180 |
-
with
|
181 |
-
st.session_state.selections['
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
# Generate prompt based on selections
|
186 |
-
is_complete = all([
|
187 |
-
st.session_state.selections['role'], st.session_state.selections['tone'],
|
188 |
-
st.session_state.selections['instruction'], st.session_state.selections['length'],
|
189 |
-
st.session_state.selections['content_type'], st.session_state.selections['audience'],
|
190 |
-
st.session_state.selections['format'], st.session_state.selections['about']
|
191 |
-
])
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
It should be about {sel['about']}."""
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
if sel['exclusion']:
|
204 |
-
prompt += f"\nExclude {sel['exclusion']}."
|
205 |
-
|
206 |
-
prompt += f"\n\nReturn the output as {sel['format']['emoji']} {sel['format']['name']}."
|
207 |
-
|
208 |
-
if sel['input_data']:
|
209 |
-
prompt += f"\nUse the following information: {sel['input_data']}"
|
210 |
-
else:
|
211 |
-
prompt = "Select all required components and provide a topic."
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
216 |
|
217 |
-
|
218 |
-
col1, col2 = st.columns(2)
|
219 |
-
with col1:
|
220 |
-
if st.button("📋 Copy", type="primary", use_container_width=True):
|
221 |
-
st.code(prompt) # This is just to show it was copied
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
for category in ['role', 'tone', 'instruction', 'length', 'content_type', 'audience', 'format']:
|
235 |
st.session_state.selections[category] = random.choice(data[category+'s'])
|
236 |
st.experimental_rerun()
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
239 |
st.markdown("""
|
240 |
-
<div style="
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
247 |
</div>
|
248 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
-
|
251 |
-
# Display sample prompts in a compact layout
|
252 |
-
for prompt in sample_prompts:
|
253 |
-
st.markdown(f"""
|
254 |
-
<div style="background-color: {prompt['color']}; border: 1px solid {prompt['border']}; border-radius: 5px; padding: 5px; margin-bottom: 5px; font-size: 0.8em;">
|
255 |
-
<b>{prompt['title']}</b><pre style="white-space: pre-wrap; font-size: 0.85em; margin: 3px 0px;">{prompt['prompt']}</pre>
|
256 |
</div>
|
257 |
""", unsafe_allow_html=True)
|
258 |
|
259 |
-
# Quick
|
260 |
st.markdown("""
|
261 |
-
<div style="background-color: #
|
262 |
-
<b
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
<li>Specify the target audience for better tailoring</li>
|
267 |
-
<li>Use structured prompts for consistent results</li>
|
268 |
-
</ul>
|
269 |
</div>
|
270 |
""", unsafe_allow_html=True)
|
|
|
5 |
# Set page configuration
|
6 |
st.set_page_config(page_title="ChatGPT Prompt Generator", page_icon="🧠", layout="wide")
|
7 |
|
8 |
+
# Custom CSS for ultra-compact layout with wide columns
|
9 |
st.markdown("""
|
10 |
<style>
|
11 |
.main {background-color: #f8f9fa;}
|
12 |
.stButton button {
|
13 |
+
border-radius: 4px;
|
14 |
+
padding: 1px 3px;
|
15 |
+
font-size: 0.7em;
|
16 |
display: inline-flex;
|
17 |
align-items: center;
|
18 |
margin: 1px;
|
19 |
min-height: 0px;
|
20 |
+
white-space: nowrap;
|
21 |
}
|
22 |
.stButton button:hover {background-color: #e9ecef;}
|
23 |
+
div[data-testid="stVerticalBlock"] {gap: 0.3rem;}
|
24 |
+
div[data-testid="stHorizontalBlock"] {gap: 0.3rem;}
|
25 |
.stTextArea textarea, .stTextInput input {
|
26 |
+
padding: 0.2rem;
|
27 |
+
font-size: 0.7em;
|
28 |
min-height: 0px;
|
29 |
}
|
30 |
div[data-testid="stForm"] {border-width: 0px; padding: 0rem 0rem;}
|
31 |
.row-widget.stRadio > div {flex-direction: row;}
|
32 |
+
.row-widget.stRadio > div > label {margin: 0px 0.1rem; padding: 0.1rem 0.3rem; font-size: 0.7em;}
|
33 |
+
h1, h2, h3 {margin-top: 0; margin-bottom: 0.1rem; font-size: 0.9rem;}
|
34 |
+
p, div {margin-bottom: 0.1rem; font-size: 0.8rem;}
|
35 |
+
.wide-grid-container {
|
|
|
36 |
display: grid;
|
37 |
+
grid-template-columns: repeat(10, 1fr);
|
38 |
gap: 2px;
|
39 |
}
|
|
|
40 |
.section-header {
|
41 |
font-weight: bold;
|
42 |
+
font-size: 0.9rem;
|
43 |
+
margin-bottom: 0.1rem;
|
44 |
+
margin-top: 0.2rem;
|
45 |
+
color: #333;
|
46 |
}
|
47 |
.prompt-display {
|
48 |
background-color: #ffffff;
|
49 |
+
border-radius: 4px;
|
50 |
+
padding: 8px;
|
51 |
border: 1px solid #e9ecef;
|
52 |
+
min-height: 100px;
|
53 |
+
font-size: 0.8em;
|
54 |
white-space: pre-wrap;
|
55 |
}
|
56 |
.sample-prompt {
|
57 |
+
font-size: 0.7em;
|
58 |
+
padding: 3px;
|
59 |
+
border-radius: 4px;
|
60 |
+
margin-bottom: 3px;
|
61 |
}
|
62 |
+
.emoji {font-size: 0.9em;}
|
63 |
</style>
|
64 |
""", unsafe_allow_html=True)
|
65 |
|
|
|
81 |
{"name": "Life Coach", "emoji": "🧘"}, {"name": "Data Analyst", "emoji": "📈"},
|
82 |
{"name": "Influencer", "emoji": "📱"}, {"name": "Language Tutor", "emoji": "🗣️"},
|
83 |
{"name": "Fitness Trainer", "emoji": "💪"}, {"name": "Teacher", "emoji": "👨🏫"},
|
84 |
+
{"name": "Therapist", "emoji": "🧐"}, {"name": "Detective", "emoji": "🔍"},
|
85 |
+
{"name": "Journalist", "emoji": "📰"}, {"name": "Scientist", "emoji": "🔬"},
|
86 |
+
{"name": "Chef", "emoji": "👨🍳"}, {"name": "Artist", "emoji": "🎨"}
|
87 |
],
|
88 |
'tones': [
|
89 |
{"name": "Informative", "emoji": "ℹ️"}, {"name": "Inspirational", "emoji": "✨"},
|
|
|
91 |
{"name": "Professional", "emoji": "👔"}, {"name": "Casual", "emoji": "👋"},
|
92 |
{"name": "Persuasive", "emoji": "🤝"}, {"name": "Encouraging", "emoji": "🙌"},
|
93 |
{"name": "Empathetic", "emoji": "🤗"}, {"name": "Serious", "emoji": "😐"},
|
94 |
+
{"name": "Enthusiastic", "emoji": "🤩"}, {"name": "Thoughtful", "emoji": "💭"},
|
95 |
+
{"name": "Sarcastic", "emoji": "😏"}, {"name": "Motivated", "emoji": "💪"},
|
96 |
+
{"name": "Critical", "emoji": "🧐"}, {"name": "Optimistic", "emoji": "😃"}
|
97 |
],
|
98 |
'instructions': [
|
99 |
{"name": "Create", "emoji": "🔨"}, {"name": "Suggest", "emoji": "💡"},
|
|
|
101 |
{"name": "Analyze", "emoji": "🔍"}, {"name": "Explain", "emoji": "📚"},
|
102 |
{"name": "Describe", "emoji": "🔎"}, {"name": "Summarize", "emoji": "📋"},
|
103 |
{"name": "Compare", "emoji": "⚖️"}, {"name": "Outline", "emoji": "📋"},
|
104 |
+
{"name": "Evaluate", "emoji": "⭐"}, {"name": "List", "emoji": "📋"},
|
105 |
+
{"name": "Draft", "emoji": "📃"}, {"name": "Review", "emoji": "👁️"},
|
106 |
+
{"name": "Generate", "emoji": "⚙️"}, {"name": "Plan", "emoji": "🗓️"}
|
107 |
],
|
108 |
'lengths': [
|
109 |
+
{"name": "100 Words", "emoji": "📎"}, {"name": "300 Words", "emoji": "📝"},
|
110 |
+
{"name": "500 Words", "emoji": "📄"}, {"name": "1000 Words", "emoji": "📃"},
|
111 |
{"name": "Short", "emoji": "🩳"}, {"name": "Medium", "emoji": "📊"},
|
112 |
{"name": "Long", "emoji": "📜"}, {"name": "Brief", "emoji": "💨"},
|
113 |
{"name": "Detailed", "emoji": "🔎"}, {"name": "Comprehensive", "emoji": "📚"}
|
|
|
118 |
{"name": "Summary", "emoji": "📋"}, {"name": "Story", "emoji": "📖"},
|
119 |
{"name": "Essay", "emoji": "📄"}, {"name": "Review", "emoji": "⭐"},
|
120 |
{"name": "Tutorial", "emoji": "👨🏫"}, {"name": "Report", "emoji": "📊"},
|
121 |
+
{"name": "Plan", "emoji": "📆"}, {"name": "Script", "emoji": "🎬"},
|
122 |
+
{"name": "Outline", "emoji": "📑"}, {"name": "Letter", "emoji": "✉️"},
|
123 |
+
{"name": "Presentation", "emoji": "🎯"}, {"name": "Analysis", "emoji": "📈"}
|
124 |
],
|
125 |
'audiences': [
|
126 |
{"name": "Beginners", "emoji": "🌱"}, {"name": "Experts", "emoji": "🧠"},
|
127 |
{"name": "Students", "emoji": "🎓"}, {"name": "Professionals", "emoji": "👔"},
|
128 |
{"name": "Business Owners", "emoji": "💼"}, {"name": "General Public", "emoji": "👥"},
|
129 |
+
{"name": "Developers", "emoji": "💻"}, {"name": "Children", "emoji": "👶"},
|
130 |
+
{"name": "Executives", "emoji": "👩💼"}, {"name": "Seniors", "emoji": "👵"},
|
131 |
+
{"name": "Teachers", "emoji": "👩🏫"}, {"name": "Parents", "emoji": "👪"}
|
132 |
],
|
133 |
'formats': [
|
134 |
{"name": "Markdown", "emoji": "📝"}, {"name": "HTML", "emoji": "🌐"},
|
135 |
{"name": "Plain Text", "emoji": "📄"}, {"name": "JSON", "emoji": "🔄"},
|
136 |
+
{"name": "PDF", "emoji": "📑"}, {"name": "Python", "emoji": "🐍"},
|
137 |
+
{"name": "JavaScript", "emoji": "📜"}, {"name": "SQL", "emoji": "💾"},
|
138 |
+
{"name": "CSV", "emoji": "📊"}, {"name": "XML", "emoji": "📓"}
|
139 |
]
|
140 |
}
|
141 |
|
142 |
+
# Function to create buttons for a category in a wide grid
|
143 |
+
def create_wide_grid_buttons(category_name, items):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
st.markdown(f"<div class='section-header'>{category_name}</div>", unsafe_allow_html=True)
|
145 |
+
st.markdown("<div class='wide-grid-container'>", unsafe_allow_html=True)
|
146 |
|
147 |
for i, item in enumerate(items):
|
148 |
key = f"{category_name.lower().replace(' ', '_')}_{i}"
|
|
|
150 |
button_type = "primary" if is_selected else "secondary"
|
151 |
|
152 |
if st.button(f"{item['emoji']} {item['name']}", key=key, help=f"Select {item['name']}",
|
153 |
+
type=button_type, use_container_width=True):
|
154 |
st.session_state.selections[category_name.lower().replace(' ', '_')] = item
|
155 |
st.experimental_rerun()
|
156 |
|
157 |
st.markdown("</div>", unsafe_allow_html=True)
|
158 |
|
159 |
+
# Minimal header
|
160 |
+
st.markdown("<h2 style='text-align: center; font-size: 1.2rem;'><span class='emoji'>🧠</span> ChatGPT Prompt Generator</h2>", unsafe_allow_html=True)
|
161 |
|
162 |
+
# Main layout - Two rows with many columns
|
163 |
+
row1, row2 = st.columns([7, 3])
|
164 |
|
165 |
+
with row1:
|
166 |
+
# First set of categories
|
167 |
+
col1, col2 = st.columns(2)
|
168 |
+
|
169 |
+
with col1:
|
170 |
+
create_wide_grid_buttons("Role", data['roles'])
|
171 |
+
create_wide_grid_buttons("Tone", data['tones'])
|
172 |
+
create_wide_grid_buttons("Instruction", data['instructions'])
|
173 |
+
|
174 |
+
with col2:
|
175 |
+
create_wide_grid_buttons("Length", data['lengths'])
|
176 |
+
create_wide_grid_buttons("Content Type", data['content_types'])
|
177 |
+
create_wide_grid_buttons("Audience", data['audiences'])
|
178 |
+
|
179 |
+
# Format and text fields in a more compact layout
|
180 |
+
format_col, inputs_col = st.columns([2, 8])
|
181 |
|
182 |
+
with format_col:
|
183 |
+
create_wide_grid_buttons("Format", data['formats'])
|
184 |
+
|
185 |
+
with inputs_col:
|
186 |
+
text_col1, text_col2, text_col3, text_col4 = st.columns(4)
|
|
|
|
|
|
|
|
|
187 |
|
188 |
+
with text_col1:
|
189 |
+
st.session_state.selections['about'] = st.text_input("💬 Topic",
|
190 |
+
value=st.session_state.selections['about'],
|
191 |
+
placeholder="Enter topic",
|
192 |
+
label_visibility="collapsed")
|
193 |
|
194 |
+
with text_col2:
|
195 |
+
st.session_state.selections['inclusion'] = st.text_input("✅ Include",
|
196 |
+
value=st.session_state.selections['inclusion'],
|
197 |
+
placeholder="What to include",
|
198 |
+
label_visibility="collapsed")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
|
200 |
+
with text_col3:
|
201 |
+
st.session_state.selections['exclusion'] = st.text_input("❌ Exclude",
|
202 |
+
value=st.session_state.selections['exclusion'],
|
203 |
+
placeholder="What to exclude",
|
204 |
+
label_visibility="collapsed")
|
205 |
+
|
206 |
+
with text_col4:
|
207 |
+
st.session_state.selections['input_data'] = st.text_input("📊 Data",
|
208 |
+
value=st.session_state.selections['input_data'],
|
209 |
+
placeholder="Input data",
|
210 |
+
label_visibility="collapsed")
|
211 |
+
|
212 |
+
with row2:
|
213 |
+
# Generate prompt based on selections
|
214 |
+
is_complete = all([
|
215 |
+
st.session_state.selections['role'], st.session_state.selections['tone'],
|
216 |
+
st.session_state.selections['instruction'], st.session_state.selections['length'],
|
217 |
+
st.session_state.selections['content_type'], st.session_state.selections['audience'],
|
218 |
+
st.session_state.selections['format'], st.session_state.selections['about']
|
219 |
+
])
|
220 |
+
|
221 |
+
prompt = ""
|
222 |
+
if is_complete:
|
223 |
+
sel = st.session_state.selections
|
224 |
+
prompt = f"""Act as a {sel['role']['emoji']} {sel['role']['name']}, use {sel['tone']['emoji']} {sel['tone']['name']} tone, {sel['instruction']['emoji']} {sel['instruction']['name']} a {sel['length']['emoji']} {sel['length']['name']} {sel['content_type']['emoji']} {sel['content_type']['name']} for {sel['audience']['emoji']} {sel['audience']['name']}.
|
225 |
|
226 |
It should be about {sel['about']}."""
|
227 |
|
228 |
+
if sel['inclusion']:
|
229 |
+
prompt += f"\nInclude {sel['inclusion']}."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
|
231 |
+
if sel['exclusion']:
|
232 |
+
prompt += f"\nExclude {sel['exclusion']}."
|
|
|
233 |
|
234 |
+
prompt += f"\n\nReturn the output as {sel['format']['emoji']} {sel['format']['name']}."
|
|
|
|
|
|
|
|
|
235 |
|
236 |
+
if sel['input_data']:
|
237 |
+
prompt += f"\nUse the following information: {sel['input_data']}"
|
238 |
+
else:
|
239 |
+
prompt = "Select all required components and provide a topic."
|
240 |
+
|
241 |
+
st.markdown("<div class='prompt-display'>", unsafe_allow_html=True)
|
242 |
+
st.write(prompt)
|
243 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
244 |
+
|
245 |
+
# Action buttons in a row
|
246 |
+
button_col1, button_col2, button_col3 = st.columns(3)
|
247 |
+
with button_col1:
|
248 |
+
if st.button("📋 Copy", type="primary", use_container_width=True):
|
249 |
+
st.code(prompt, language="") # This is just to show it was copied
|
250 |
+
|
251 |
+
with button_col2:
|
252 |
+
if st.button("🔄 Reset", type="secondary", use_container_width=True):
|
253 |
+
for key in st.session_state.selections:
|
254 |
+
if key in ['about', 'inclusion', 'exclusion', 'input_data']:
|
255 |
+
st.session_state.selections[key] = ""
|
256 |
+
else:
|
257 |
+
st.session_state.selections[key] = None
|
258 |
+
st.experimental_rerun()
|
259 |
+
|
260 |
+
with button_col3:
|
261 |
+
if st.button("🎲 Random", type="secondary", use_container_width=True):
|
262 |
for category in ['role', 'tone', 'instruction', 'length', 'content_type', 'audience', 'format']:
|
263 |
st.session_state.selections[category] = random.choice(data[category+'s'])
|
264 |
st.experimental_rerun()
|
265 |
+
|
266 |
+
# Sample prompts in 2 columns
|
267 |
+
st.markdown("<div class='section-header' style='font-size: 0.8rem;'>📚 Examples</div>", unsafe_allow_html=True)
|
268 |
+
sample_col1, sample_col2 = st.columns(2)
|
269 |
+
|
270 |
+
with sample_col1:
|
271 |
st.markdown("""
|
272 |
+
<div style="background-color: #e6f3ff; border: 1px solid #b8daff; border-radius: 4px; padding: 4px; margin-bottom: 4px; font-size: 0.7em;">
|
273 |
+
<b>👨🏫 Teaching</b><pre style="white-space: pre-wrap; font-size: 0.75em; margin: 2px 0px;">Act as a 👨🏫 Teacher, use 📚 Informative tone, Create a 📋 Guide for 🌱 Beginners.
|
274 |
+
|
275 |
+
It should be about Git version control.
|
276 |
+
Include practical examples.
|
277 |
+
Exclude advanced techniques.
|
278 |
+
|
279 |
+
Return as 📝 Markdown.</pre>
|
280 |
</div>
|
281 |
""", unsafe_allow_html=True)
|
282 |
+
|
283 |
+
with sample_col2:
|
284 |
+
st.markdown("""
|
285 |
+
<div style="background-color: #e6ffed; border: 1px solid #b8e6cc; border-radius: 4px; padding: 4px; margin-bottom: 4px; font-size: 0.7em;">
|
286 |
+
<b>💼 Business</b><pre style="white-space: pre-wrap; font-size: 0.75em; margin: 2px 0px;">Act as a 👔 Professional, use 🤝 Persuasive tone, Write a 📧 Email for 👩💼 Executives.
|
287 |
+
|
288 |
+
It should be about a product launch.
|
289 |
+
Include ROI metrics.
|
290 |
+
Exclude technical details.
|
291 |
|
292 |
+
Return as 📄 Plain Text.</pre>
|
|
|
|
|
|
|
|
|
|
|
293 |
</div>
|
294 |
""", unsafe_allow_html=True)
|
295 |
|
296 |
+
# Quick guide
|
297 |
st.markdown("""
|
298 |
+
<div style="font-size: 0.7em; background-color: #f1f8ff; border-radius: 4px; padding: 4px; margin-top: 4px;">
|
299 |
+
<b>Structure:</b> Act as [<span style="color:blue">ROLE</span>], use [<span style="color:green">TONE</span>] tone, [<span style="color:red">INSTRUCTION</span>] a [<span style="color:purple">LENGTH</span>] [<span style="color:orange">CONTENT TYPE</span>] for [<span style="color:pink">AUDIENCE</span>].<br>
|
300 |
+
It should be about [TOPIC].<br>
|
301 |
+
Include [INCLUSION]. Exclude [EXCLUSION].<br>
|
302 |
+
Return as [FORMAT].
|
|
|
|
|
|
|
303 |
</div>
|
304 |
""", unsafe_allow_html=True)
|