Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,44 +5,47 @@ 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: 4px;
|
| 14 |
-
padding:
|
| 15 |
-
font-size: 0.
|
| 16 |
-
display: inline-flex;
|
| 17 |
-
align-items: center;
|
| 18 |
-
margin: 1px;
|
| 19 |
min-height: 0px;
|
| 20 |
-
|
|
|
|
| 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.
|
| 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 |
-
.
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
| 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;
|
|
@@ -60,6 +63,9 @@ st.markdown("""
|
|
| 60 |
margin-bottom: 3px;
|
| 61 |
}
|
| 62 |
.emoji {font-size: 0.9em;}
|
|
|
|
|
|
|
|
|
|
| 63 |
</style>
|
| 64 |
""", unsafe_allow_html=True)
|
| 65 |
|
|
@@ -81,9 +87,7 @@ 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 |
-
{"name": "Journalist", "emoji": "๐ฐ"}, {"name": "Scientist", "emoji": "๐ฌ"},
|
| 86 |
-
{"name": "Chef", "emoji": "๐จโ๐ณ"}, {"name": "Artist", "emoji": "๐จ"}
|
| 87 |
],
|
| 88 |
'tones': [
|
| 89 |
{"name": "Informative", "emoji": "โน๏ธ"}, {"name": "Inspirational", "emoji": "โจ"},
|
|
@@ -91,9 +95,7 @@ data = {
|
|
| 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,13 +103,10 @@ data = {
|
|
| 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": "
|
| 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,98 +117,103 @@ data = {
|
|
| 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
|
| 143 |
-
def
|
| 144 |
-
st.markdown(f"
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
for i, item in enumerate(items):
|
| 148 |
key = f"{category_name.lower().replace(' ', '_')}_{i}"
|
| 149 |
is_selected = st.session_state.selections.get(category_name.lower().replace(' ', '_')) == item
|
| 150 |
button_type = "primary" if is_selected else "secondary"
|
| 151 |
|
| 152 |
-
if st.button(f"{item['emoji']} {item['name']}", key=key,
|
| 153 |
-
|
|
|
|
|
|
|
| 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
|
| 163 |
-
|
| 164 |
|
| 165 |
-
with
|
| 166 |
-
# First
|
| 167 |
-
|
| 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
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
create_wide_grid_buttons("Audience", data['audiences'])
|
| 178 |
|
| 179 |
-
|
| 180 |
-
|
|
|
|
| 181 |
|
| 182 |
-
with
|
| 183 |
-
|
|
|
|
| 184 |
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
| 187 |
|
| 188 |
-
with
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
st.session_state.selections['about'] = st.text_input("๐ฌ Topic",
|
| 190 |
value=st.session_state.selections['about'],
|
| 191 |
-
placeholder="Enter
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 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="
|
| 210 |
-
|
|
|
|
|
|
|
| 211 |
|
| 212 |
-
with
|
| 213 |
# Generate prompt based on selections
|
| 214 |
is_complete = all([
|
| 215 |
st.session_state.selections['role'], st.session_state.selections['tone'],
|
|
@@ -238,17 +242,19 @@ It should be about {sel['about']}."""
|
|
| 238 |
else:
|
| 239 |
prompt = "Select all required components and provide a topic."
|
| 240 |
|
| 241 |
-
st.markdown(
|
|
|
|
|
|
|
| 242 |
st.write(prompt)
|
| 243 |
-
st.markdown(
|
| 244 |
|
| 245 |
-
# Action buttons
|
| 246 |
-
|
| 247 |
-
with
|
| 248 |
if st.button("๐ Copy", type="primary", use_container_width=True):
|
| 249 |
-
st.code(prompt, language="")
|
| 250 |
|
| 251 |
-
with
|
| 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']:
|
|
@@ -256,49 +262,52 @@ It should be about {sel['about']}."""
|
|
| 256 |
else:
|
| 257 |
st.session_state.selections[key] = None
|
| 258 |
st.experimental_rerun()
|
| 259 |
-
|
| 260 |
-
with
|
| 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 |
-
|
| 267 |
-
|
| 268 |
-
|
|
|
|
|
|
|
| 269 |
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
<
|
| 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
|
| 276 |
Include practical examples.
|
| 277 |
Exclude advanced techniques.
|
| 278 |
|
| 279 |
Return as ๐ Markdown.</pre>
|
| 280 |
-
|
| 281 |
-
|
| 282 |
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
<
|
| 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 |
-
|
| 294 |
-
|
| 295 |
|
| 296 |
-
#
|
| 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
|
|
|
|
| 300 |
It should be about [TOPIC].<br>
|
| 301 |
Include [INCLUSION]. Exclude [EXCLUSION].<br>
|
| 302 |
Return as [FORMAT].
|
| 303 |
</div>
|
| 304 |
-
""", 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 compact buttons in grouped containers
|
| 9 |
st.markdown("""
|
| 10 |
<style>
|
| 11 |
.main {background-color: #f8f9fa;}
|
| 12 |
.stButton button {
|
| 13 |
border-radius: 4px;
|
| 14 |
+
padding: 2px 4px;
|
| 15 |
+
font-size: 0.75em;
|
|
|
|
|
|
|
|
|
|
| 16 |
min-height: 0px;
|
| 17 |
+
margin: 1px;
|
| 18 |
+
display: inline-block;
|
| 19 |
}
|
| 20 |
.stButton button:hover {background-color: #e9ecef;}
|
| 21 |
div[data-testid="stVerticalBlock"] {gap: 0.3rem;}
|
| 22 |
div[data-testid="stHorizontalBlock"] {gap: 0.3rem;}
|
| 23 |
.stTextArea textarea, .stTextInput input {
|
| 24 |
padding: 0.2rem;
|
| 25 |
+
font-size: 0.8em;
|
| 26 |
min-height: 0px;
|
| 27 |
}
|
|
|
|
|
|
|
|
|
|
| 28 |
h1, h2, h3 {margin-top: 0; margin-bottom: 0.1rem; font-size: 0.9rem;}
|
| 29 |
p, div {margin-bottom: 0.1rem; font-size: 0.8rem;}
|
| 30 |
+
.category-container {
|
| 31 |
+
background-color: white;
|
| 32 |
+
border: 1px solid #e6e6e6;
|
| 33 |
+
border-radius: 4px;
|
| 34 |
+
padding: 5px;
|
| 35 |
+
margin-bottom: 5px;
|
| 36 |
}
|
| 37 |
.section-header {
|
| 38 |
font-weight: bold;
|
| 39 |
font-size: 0.9rem;
|
| 40 |
margin-bottom: 0.1rem;
|
|
|
|
| 41 |
color: #333;
|
| 42 |
+
border-bottom: 1px solid #eee;
|
| 43 |
+
padding-bottom: 3px;
|
| 44 |
+
}
|
| 45 |
+
.button-flex-container {
|
| 46 |
+
display: flex;
|
| 47 |
+
flex-wrap: wrap;
|
| 48 |
+
gap: 2px;
|
| 49 |
}
|
| 50 |
.prompt-display {
|
| 51 |
background-color: #ffffff;
|
|
|
|
| 63 |
margin-bottom: 3px;
|
| 64 |
}
|
| 65 |
.emoji {font-size: 0.9em;}
|
| 66 |
+
.btn-group {
|
| 67 |
+
margin-bottom: 0px;
|
| 68 |
+
}
|
| 69 |
</style>
|
| 70 |
""", unsafe_allow_html=True)
|
| 71 |
|
|
|
|
| 87 |
{"name": "Life Coach", "emoji": "๐ง"}, {"name": "Data Analyst", "emoji": "๐"},
|
| 88 |
{"name": "Influencer", "emoji": "๐ฑ"}, {"name": "Language Tutor", "emoji": "๐ฃ๏ธ"},
|
| 89 |
{"name": "Fitness Trainer", "emoji": "๐ช"}, {"name": "Teacher", "emoji": "๐จโ๐ซ"},
|
| 90 |
+
{"name": "Therapist", "emoji": "๐ง"}, {"name": "Detective", "emoji": "๐"}
|
|
|
|
|
|
|
| 91 |
],
|
| 92 |
'tones': [
|
| 93 |
{"name": "Informative", "emoji": "โน๏ธ"}, {"name": "Inspirational", "emoji": "โจ"},
|
|
|
|
| 95 |
{"name": "Professional", "emoji": "๐"}, {"name": "Casual", "emoji": "๐"},
|
| 96 |
{"name": "Persuasive", "emoji": "๐ค"}, {"name": "Encouraging", "emoji": "๐"},
|
| 97 |
{"name": "Empathetic", "emoji": "๐ค"}, {"name": "Serious", "emoji": "๐"},
|
| 98 |
+
{"name": "Enthusiastic", "emoji": "๐คฉ"}, {"name": "Thoughtful", "emoji": "๐ญ"}
|
|
|
|
|
|
|
| 99 |
],
|
| 100 |
'instructions': [
|
| 101 |
{"name": "Create", "emoji": "๐จ"}, {"name": "Suggest", "emoji": "๐ก"},
|
|
|
|
| 103 |
{"name": "Analyze", "emoji": "๐"}, {"name": "Explain", "emoji": "๐"},
|
| 104 |
{"name": "Describe", "emoji": "๐"}, {"name": "Summarize", "emoji": "๐"},
|
| 105 |
{"name": "Compare", "emoji": "โ๏ธ"}, {"name": "Outline", "emoji": "๐"},
|
| 106 |
+
{"name": "Evaluate", "emoji": "โญ"}, {"name": "List", "emoji": "๐"}
|
|
|
|
|
|
|
| 107 |
],
|
| 108 |
'lengths': [
|
| 109 |
+
{"name": "300 Words", "emoji": "๐"}, {"name": "500 Words", "emoji": "๐"},
|
|
|
|
| 110 |
{"name": "Short", "emoji": "๐ฉณ"}, {"name": "Medium", "emoji": "๐"},
|
| 111 |
{"name": "Long", "emoji": "๐"}, {"name": "Brief", "emoji": "๐จ"},
|
| 112 |
{"name": "Detailed", "emoji": "๐"}, {"name": "Comprehensive", "emoji": "๐"}
|
|
|
|
| 117 |
{"name": "Summary", "emoji": "๐"}, {"name": "Story", "emoji": "๐"},
|
| 118 |
{"name": "Essay", "emoji": "๐"}, {"name": "Review", "emoji": "โญ"},
|
| 119 |
{"name": "Tutorial", "emoji": "๐จโ๐ซ"}, {"name": "Report", "emoji": "๐"},
|
| 120 |
+
{"name": "Plan", "emoji": "๐"}, {"name": "Script", "emoji": "๐ฌ"}
|
|
|
|
|
|
|
| 121 |
],
|
| 122 |
'audiences': [
|
| 123 |
{"name": "Beginners", "emoji": "๐ฑ"}, {"name": "Experts", "emoji": "๐ง "},
|
| 124 |
{"name": "Students", "emoji": "๐"}, {"name": "Professionals", "emoji": "๐"},
|
| 125 |
{"name": "Business Owners", "emoji": "๐ผ"}, {"name": "General Public", "emoji": "๐ฅ"},
|
| 126 |
+
{"name": "Developers", "emoji": "๐ป"}, {"name": "Children", "emoji": "๐ถ"}
|
|
|
|
|
|
|
| 127 |
],
|
| 128 |
'formats': [
|
| 129 |
{"name": "Markdown", "emoji": "๐"}, {"name": "HTML", "emoji": "๐"},
|
| 130 |
{"name": "Plain Text", "emoji": "๐"}, {"name": "JSON", "emoji": "๐"},
|
| 131 |
+
{"name": "PDF", "emoji": "๐"}, {"name": "Python Code", "emoji": "๐"},
|
| 132 |
+
{"name": "JavaScript", "emoji": "๐"}, {"name": "SQL Query", "emoji": "๐พ"}
|
|
|
|
| 133 |
]
|
| 134 |
}
|
| 135 |
|
| 136 |
+
# Function to create buttons for a category using HTML/CSS flexbox
|
| 137 |
+
def create_category_container(category_name, items, emoji_prefix=""):
|
| 138 |
+
st.markdown(f"""
|
| 139 |
+
<div class="category-container">
|
| 140 |
+
<div class="section-header">{emoji_prefix} {category_name}</div>
|
| 141 |
+
<div class="button-flex-container">
|
| 142 |
+
""", unsafe_allow_html=True)
|
| 143 |
|
| 144 |
for i, item in enumerate(items):
|
| 145 |
key = f"{category_name.lower().replace(' ', '_')}_{i}"
|
| 146 |
is_selected = st.session_state.selections.get(category_name.lower().replace(' ', '_')) == item
|
| 147 |
button_type = "primary" if is_selected else "secondary"
|
| 148 |
|
| 149 |
+
if st.button(f"{item['emoji']} {item['name']}", key=key,
|
| 150 |
+
help=f"Select {item['name']}",
|
| 151 |
+
type=button_type,
|
| 152 |
+
use_container_width=False):
|
| 153 |
st.session_state.selections[category_name.lower().replace(' ', '_')] = item
|
| 154 |
st.experimental_rerun()
|
| 155 |
|
| 156 |
+
st.markdown("</div></div>", unsafe_allow_html=True)
|
| 157 |
|
| 158 |
# Minimal header
|
| 159 |
st.markdown("<h2 style='text-align: center; font-size: 1.2rem;'><span class='emoji'>๐ง </span> ChatGPT Prompt Generator</h2>", unsafe_allow_html=True)
|
| 160 |
|
| 161 |
+
# Main layout with two columns
|
| 162 |
+
left_col, right_col = st.columns([3, 1])
|
| 163 |
|
| 164 |
+
with left_col:
|
| 165 |
+
# First row of categories in 3 columns
|
| 166 |
+
row1_col1, row1_col2, row1_col3 = st.columns(3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
+
with row1_col1:
|
| 169 |
+
create_category_container("Role", data['roles'], "๐ค")
|
| 170 |
+
create_category_container("Instruction", data['instructions'], "๐")
|
|
|
|
| 171 |
|
| 172 |
+
with row1_col2:
|
| 173 |
+
create_category_container("Tone", data['tones'], "๐ญ")
|
| 174 |
+
create_category_container("Length", data['lengths'], "๐")
|
| 175 |
|
| 176 |
+
with row1_col3:
|
| 177 |
+
create_category_container("Content Type", data['content_types'], "๐")
|
| 178 |
+
create_category_container("Audience", data['audiences'], "๐ฅ")
|
| 179 |
|
| 180 |
+
# Second row for Format and Text inputs
|
| 181 |
+
row2 = st.container()
|
| 182 |
+
with row2:
|
| 183 |
+
row2_col1, row2_col2 = st.columns([1, 3])
|
| 184 |
|
| 185 |
+
with row2_col1:
|
| 186 |
+
create_category_container("Format", data['formats'], "๐")
|
| 187 |
+
|
| 188 |
+
with row2_col2:
|
| 189 |
+
# Use a container for text inputs
|
| 190 |
+
st.markdown('<div class="category-container">', unsafe_allow_html=True)
|
| 191 |
+
st.markdown('<div class="section-header">๐ Details</div>', unsafe_allow_html=True)
|
| 192 |
+
|
| 193 |
+
# Create text inputs
|
| 194 |
st.session_state.selections['about'] = st.text_input("๐ฌ Topic",
|
| 195 |
value=st.session_state.selections['about'],
|
| 196 |
+
placeholder="Enter what the content should be about")
|
| 197 |
+
|
| 198 |
+
col1, col2 = st.columns(2)
|
| 199 |
+
with col1:
|
| 200 |
+
st.session_state.selections['inclusion'] = st.text_input("โ
Include",
|
| 201 |
+
value=st.session_state.selections['inclusion'],
|
| 202 |
+
placeholder="What to include in the content")
|
| 203 |
+
|
| 204 |
+
with col2:
|
| 205 |
+
st.session_state.selections['exclusion'] = st.text_input("โ Exclude",
|
| 206 |
+
value=st.session_state.selections['exclusion'],
|
| 207 |
+
placeholder="What to exclude from the content")
|
| 208 |
+
|
| 209 |
+
st.session_state.selections['input_data'] = st.text_area("๐ Input Data",
|
|
|
|
|
|
|
|
|
|
| 210 |
value=st.session_state.selections['input_data'],
|
| 211 |
+
placeholder="Enter any specific information to use",
|
| 212 |
+
height=60)
|
| 213 |
+
|
| 214 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 215 |
|
| 216 |
+
with right_col:
|
| 217 |
# Generate prompt based on selections
|
| 218 |
is_complete = all([
|
| 219 |
st.session_state.selections['role'], st.session_state.selections['tone'],
|
|
|
|
| 242 |
else:
|
| 243 |
prompt = "Select all required components and provide a topic."
|
| 244 |
|
| 245 |
+
st.markdown('<div class="category-container">', unsafe_allow_html=True)
|
| 246 |
+
st.markdown('<div class="section-header">๐ฎ Generated Prompt</div>', unsafe_allow_html=True)
|
| 247 |
+
st.markdown('<div class="prompt-display">', unsafe_allow_html=True)
|
| 248 |
st.write(prompt)
|
| 249 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 250 |
|
| 251 |
+
# Action buttons
|
| 252 |
+
btn1, btn2, btn3 = st.columns(3)
|
| 253 |
+
with btn1:
|
| 254 |
if st.button("๐ Copy", type="primary", use_container_width=True):
|
| 255 |
+
st.code(prompt, language="")
|
| 256 |
|
| 257 |
+
with btn2:
|
| 258 |
if st.button("๐ Reset", type="secondary", use_container_width=True):
|
| 259 |
for key in st.session_state.selections:
|
| 260 |
if key in ['about', 'inclusion', 'exclusion', 'input_data']:
|
|
|
|
| 262 |
else:
|
| 263 |
st.session_state.selections[key] = None
|
| 264 |
st.experimental_rerun()
|
| 265 |
+
|
| 266 |
+
with btn3:
|
| 267 |
if st.button("๐ฒ Random", type="secondary", use_container_width=True):
|
| 268 |
for category in ['role', 'tone', 'instruction', 'length', 'content_type', 'audience', 'format']:
|
| 269 |
st.session_state.selections[category] = random.choice(data[category+'s'])
|
| 270 |
st.experimental_rerun()
|
| 271 |
|
| 272 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 273 |
+
|
| 274 |
+
# Sample prompts
|
| 275 |
+
st.markdown('<div class="category-container">', unsafe_allow_html=True)
|
| 276 |
+
st.markdown('<div class="section-header">๐ Examples</div>', unsafe_allow_html=True)
|
| 277 |
|
| 278 |
+
st.markdown("""
|
| 279 |
+
<div style="background-color: #e6f3ff; border: 1px solid #b8daff; border-radius: 4px; padding: 4px; margin-bottom: 4px; font-size: 0.7em;">
|
| 280 |
+
<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.
|
|
|
|
| 281 |
|
| 282 |
+
It should be about Git.
|
| 283 |
Include practical examples.
|
| 284 |
Exclude advanced techniques.
|
| 285 |
|
| 286 |
Return as ๐ Markdown.</pre>
|
| 287 |
+
</div>
|
| 288 |
+
""", unsafe_allow_html=True)
|
| 289 |
|
| 290 |
+
st.markdown("""
|
| 291 |
+
<div style="background-color: #e6ffed; border: 1px solid #b8e6cc; border-radius: 4px; padding: 4px; margin-bottom: 4px; font-size: 0.7em;">
|
| 292 |
+
<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.
|
|
|
|
| 293 |
|
| 294 |
It should be about a product launch.
|
| 295 |
Include ROI metrics.
|
| 296 |
Exclude technical details.
|
| 297 |
|
| 298 |
Return as ๐ Plain Text.</pre>
|
| 299 |
+
</div>
|
| 300 |
+
""", unsafe_allow_html=True)
|
| 301 |
|
| 302 |
+
# Structure guide
|
| 303 |
st.markdown("""
|
| 304 |
<div style="font-size: 0.7em; background-color: #f1f8ff; border-radius: 4px; padding: 4px; margin-top: 4px;">
|
| 305 |
+
<b>Structure:</b><br>
|
| 306 |
+
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>
|
| 307 |
It should be about [TOPIC].<br>
|
| 308 |
Include [INCLUSION]. Exclude [EXCLUSION].<br>
|
| 309 |
Return as [FORMAT].
|
| 310 |
</div>
|
| 311 |
+
""", unsafe_allow_html=True)
|
| 312 |
+
|
| 313 |
+
st.markdown('</div>', unsafe_allow_html=True)
|