Spaces:
Running
Running
File size: 25,970 Bytes
d5fd24d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
import streamlit as st
import pandas as pd
from streamlit_option_menu import option_menu
import random
# Set page configuration
st.set_page_config(
page_title="ChatGPT Prompt Generator",
page_icon="๐ง ",
layout="wide",
initial_sidebar_state="expanded"
)
# Custom CSS
st.markdown("""
<style>
.main {
background-color: #f8f9fa;
}
.stButton button {
border-radius: 10px;
padding: 5px 10px;
font-weight: 500;
display: flex;
align-items: center;
justify-content: flex-start;
width: 100%;
text-align: left;
}
.stButton button:hover {
background-color: #e9ecef;
}
.selected-button {
background-color: #4e8df5 !important;
color: white !important;
}
.stTextArea textarea {
border-radius: 10px;
border: 1px solid #ced4da;
}
.stTextInput input {
border-radius: 10px;
border: 1px solid #ced4da;
}
.css-18e3th9 {
padding-top: 1rem;
}
.css-1d391kg {
padding: 1rem;
}
.section-title {
font-size: 20px;
font-weight: 600;
margin-bottom: 10px;
color: #333;
}
.highlight-box {
background-color: #f1f8ff;
border-radius: 10px;
padding: 15px;
border: 1px solid #c2e0ff;
}
.emoji-large {
font-size: 24px;
}
.prompt-display {
background-color: #ffffff;
border-radius: 10px;
padding: 20px;
border: 1px solid #e9ecef;
min-height: 200px;
white-space: pre-wrap;
}
.sample-prompt {
background-color: #f8f9fa;
border-radius: 10px;
padding: 15px;
border: 1px solid #e9ecef;
margin-bottom: 10px;
}
.category-container {
max-height: 200px;
overflow-y: auto;
padding-right: 10px;
margin-bottom: 20px;
}
.button-container {
display: flex;
flex-wrap: wrap;
gap: 5px;
}
</style>
""", unsafe_allow_html=True)
# Initialize session state
if 'selected_role' not in st.session_state:
st.session_state.selected_role = None
if 'selected_tone' not in st.session_state:
st.session_state.selected_tone = None
if 'selected_instruction' not in st.session_state:
st.session_state.selected_instruction = None
if 'selected_length' not in st.session_state:
st.session_state.selected_length = None
if 'selected_content_type' not in st.session_state:
st.session_state.selected_content_type = None
if 'selected_audience' not in st.session_state:
st.session_state.selected_audience = None
if 'selected_format' not in st.session_state:
st.session_state.selected_format = None
if 'about' not in st.session_state:
st.session_state.about = ""
if 'inclusion' not in st.session_state:
st.session_state.inclusion = ""
if 'exclusion' not in st.session_state:
st.session_state.exclusion = ""
if 'input_data' not in st.session_state:
st.session_state.input_data = ""
# Data sets
roles = [
{"name": "Professional", "emoji": "๐"},
{"name": "Expert", "emoji": "๐ง "},
{"name": "Friend", "emoji": "๐ค"},
{"name": "Copywriter", "emoji": "โ๏ธ"},
{"name": "Creative Writer", "emoji": "๐๏ธ"},
{"name": "Sales Coach", "emoji": "๐ผ"},
{"name": "Marketing Coach", "emoji": "๐"},
{"name": "Tech Consultant", "emoji": "๐ป"},
{"name": "Life Coach", "emoji": "๐ง"},
{"name": "Data Analyst", "emoji": "๐"},
{"name": "Influencer", "emoji": "๐ฑ"},
{"name": "Language Tutor", "emoji": "๐ฃ๏ธ"},
{"name": "Fitness Trainer", "emoji": "๐ช"},
{"name": "Teacher", "emoji": "๐จโ๐ซ"},
{"name": "Therapist", "emoji": "๐ง"},
{"name": "Detective", "emoji": "๐"}
]
tones = [
{"name": "Informative", "emoji": "โน๏ธ"},
{"name": "Inspirational", "emoji": "โจ"},
{"name": "Humorous", "emoji": "๐"},
{"name": "Friendly", "emoji": "๐"},
{"name": "Professional", "emoji": "๐"},
{"name": "Casual", "emoji": "๐"},
{"name": "Persuasive", "emoji": "๐ค"},
{"name": "Encouraging", "emoji": "๐"},
{"name": "Empathetic", "emoji": "๐ค"},
{"name": "Serious", "emoji": "๐"},
{"name": "Enthusiastic", "emoji": "๐คฉ"},
{"name": "Thoughtful", "emoji": "๐ญ"}
]
instructions = [
{"name": "Create", "emoji": "๐จ"},
{"name": "Suggest", "emoji": "๐ก"},
{"name": "Write", "emoji": "โ๏ธ"},
{"name": "Compose", "emoji": "๐"},
{"name": "Analyze", "emoji": "๐"},
{"name": "Explain", "emoji": "๐"},
{"name": "Describe", "emoji": "๐"},
{"name": "Summarize", "emoji": "๐"},
{"name": "Compare", "emoji": "โ๏ธ"},
{"name": "Outline", "emoji": "๐"},
{"name": "Evaluate", "emoji": "โญ"},
{"name": "List", "emoji": "๐"}
]
lengths = [
{"name": "300 Words", "emoji": "๐"},
{"name": "500 Words", "emoji": "๐"},
{"name": "1000 Words", "emoji": "๐"},
{"name": "5 Paragraphs", "emoji": "๐"},
{"name": "10 Lines", "emoji": "๐"},
{"name": "Short", "emoji": "๐ฉณ"},
{"name": "Medium", "emoji": "๐"},
{"name": "Long", "emoji": "๐"},
{"name": "Brief", "emoji": "๐จ"},
{"name": "Detailed", "emoji": "๐"},
{"name": "Comprehensive", "emoji": "๐"},
{"name": "Concise", "emoji": "โ๏ธ"}
]
content_types = [
{"name": "Article", "emoji": "๐ฐ"},
{"name": "Blog post", "emoji": "๐"},
{"name": "Guide", "emoji": "๐"},
{"name": "Email", "emoji": "๐ง"},
{"name": "Summary", "emoji": "๐"},
{"name": "Story", "emoji": "๐"},
{"name": "Essay", "emoji": "๐"},
{"name": "Review", "emoji": "โญ"},
{"name": "Tutorial", "emoji": "๐จโ๐ซ"},
{"name": "Report", "emoji": "๐"},
{"name": "Plan", "emoji": "๐"},
{"name": "Script", "emoji": "๐ฌ"}
]
audiences = [
{"name": "Beginners", "emoji": "๐ฑ"},
{"name": "Experts", "emoji": "๐ง "},
{"name": "Students", "emoji": "๐"},
{"name": "Professionals", "emoji": "๐"},
{"name": "Business Owners", "emoji": "๐ผ"},
{"name": "General Public", "emoji": "๐ฅ"},
{"name": "Developers", "emoji": "๐ป"},
{"name": "Children", "emoji": "๐ถ"},
{"name": "Teachers", "emoji": "๐ฉโ๐ซ"},
{"name": "Executives", "emoji": "๐ฉโ๐ผ"},
{"name": "Researchers", "emoji": "๐ฌ"},
{"name": "Gamers", "emoji": "๐ฎ"}
]
formats = [
{"name": "Markdown", "emoji": "๐"},
{"name": "HTML", "emoji": "๐"},
{"name": "Plain Text", "emoji": "๐"},
{"name": "JSON", "emoji": "๐"},
{"name": "PDF", "emoji": "๐"},
{"name": "Python Code", "emoji": "๐"},
{"name": "JavaScript", "emoji": "๐"},
{"name": "SQL Query", "emoji": "๐พ"},
{"name": "LaTeX", "emoji": "๐"},
{"name": "Presentation", "emoji": "๐"},
{"name": "SVG", "emoji": "๐ผ๏ธ"},
{"name": "CSV", "emoji": "๐"}
]
# Sample prompts
sample_prompts = [
{
"title": "๐จโ๐ซ Teaching Example",
"color": "#e6f3ff",
"border": "#b8daff",
"prompt": """Act as a ๐จโ๐ซ Teacher, use ๐ Informative tone, Create a ๐ Comprehensive Guide for ๐ฑ Beginners.
It should be about Git version control.
Include practical examples and best practices.
Exclude advanced techniques for now.
Return the output as ๐ Markdown."""
},
{
"title": "๐ผ Business Example",
"color": "#e6ffed",
"border": "#b8e6cc",
"prompt": """Act as a ๐ Professional, use ๐ค Persuasive tone, Write a ๐ง Email for ๐ฉโ๐ผ Executives.
It should be about a new product launch.
Include key benefits and ROI metrics.
Exclude technical specifications.
Return the output as ๐ Plain Text."""
},
{
"title": "๐ป Technical Example",
"color": "#f2e6ff",
"border": "#d9b8ff",
"prompt": """Act as a ๐ป Tech Consultant, use โน๏ธ Informative tone, Explain a ๐ Tutorial for ๐ป Developers.
It should be about React hooks.
Include real-world use cases.
Exclude class components.
Return the output as ๐ JavaScript."""
},
{
"title": "๐ Creative Example",
"color": "#fff8e6",
"border": "#ffe0b8",
"prompt": """Act as a ๐๏ธ Creative Writer, use ๐ Humorous tone, Compose a ๐ Story for ๐ถ Children.
It should be about a friendly dragon.
Include a moral lesson about friendship.
Exclude scary elements.
Return the output as ๐ Markdown."""
}
]
# Header
st.markdown("<h1 style='text-align: center; color: #1e3a8a;'><span class='emoji-large'>๐ง </span> ChatGPT Prompt Generator</h1>", unsafe_allow_html=True)
st.markdown("<p style='text-align: center; margin-bottom: 30px;'>Based on Gyula Rabai's ChatGPT Cheat Sheet</p>", unsafe_allow_html=True)
# Main layout
tab1, tab2, tab3 = st.tabs(["๐ฎ Generate Prompt", "๐ Examples", "โน๏ธ About"])
with tab1:
col1, col2 = st.columns([5, 3])
with col1:
st.markdown("<p class='section-title'>โ๏ธ Select Prompt Components</p>", unsafe_allow_html=True)
# Create columns for categories
row1_col1, row1_col2 = st.columns(2)
with row1_col1:
st.markdown("### ๐ค Choose a Role")
st.markdown("<div class='category-container'>", unsafe_allow_html=True)
st.markdown("<div class='button-container'>", unsafe_allow_html=True)
for i, role in enumerate(roles):
role_key = f"role_{i}"
if st.button(f"{role['emoji']} {role['name']}", key=role_key,
help=f"Select {role['name']} as your role",
use_container_width=True,
type="secondary" if st.session_state.selected_role != role else "primary"):
st.session_state.selected_role = role
st.markdown("</div></div>", unsafe_allow_html=True)
with row1_col2:
st.markdown("### ๐ญ Select a Tone")
st.markdown("<div class='category-container'>", unsafe_allow_html=True)
st.markdown("<div class='button-container'>", unsafe_allow_html=True)
for i, tone in enumerate(tones):
tone_key = f"tone_{i}"
if st.button(f"{tone['emoji']} {tone['name']}", key=tone_key,
help=f"Select {tone['name']} tone",
use_container_width=True,
type="secondary" if st.session_state.selected_tone != tone else "primary"):
st.session_state.selected_tone = tone
st.markdown("</div></div>", unsafe_allow_html=True)
row2_col1, row2_col2 = st.columns(2)
with row2_col1:
st.markdown("### ๐ Select an Instruction")
st.markdown("<div class='category-container'>", unsafe_allow_html=True)
st.markdown("<div class='button-container'>", unsafe_allow_html=True)
for i, instruction in enumerate(instructions):
instruction_key = f"instruction_{i}"
if st.button(f"{instruction['emoji']} {instruction['name']}", key=instruction_key,
help=f"Select {instruction['name']} as your instruction",
use_container_width=True,
type="secondary" if st.session_state.selected_instruction != instruction else "primary"):
st.session_state.selected_instruction = instruction
st.markdown("</div></div>", unsafe_allow_html=True)
with row2_col2:
st.markdown("### ๐ Select Length")
st.markdown("<div class='category-container'>", unsafe_allow_html=True)
st.markdown("<div class='button-container'>", unsafe_allow_html=True)
for i, length in enumerate(lengths):
length_key = f"length_{i}"
if st.button(f"{length['emoji']} {length['name']}", key=length_key,
help=f"Select {length['name']} as your length",
use_container_width=True,
type="secondary" if st.session_state.selected_length != length else "primary"):
st.session_state.selected_length = length
st.markdown("</div></div>", unsafe_allow_html=True)
row3_col1, row3_col2 = st.columns(2)
with row3_col1:
st.markdown("### ๐ Select Content Type")
st.markdown("<div class='category-container'>", unsafe_allow_html=True)
st.markdown("<div class='button-container'>", unsafe_allow_html=True)
for i, content_type in enumerate(content_types):
content_type_key = f"content_type_{i}"
if st.button(f"{content_type['emoji']} {content_type['name']}", key=content_type_key,
help=f"Select {content_type['name']} as your content type",
use_container_width=True,
type="secondary" if st.session_state.selected_content_type != content_type else "primary"):
st.session_state.selected_content_type = content_type
st.markdown("</div></div>", unsafe_allow_html=True)
with row3_col2:
st.markdown("### ๐ฅ Select Target Audience")
st.markdown("<div class='category-container'>", unsafe_allow_html=True)
st.markdown("<div class='button-container'>", unsafe_allow_html=True)
for i, audience in enumerate(audiences):
audience_key = f"audience_{i}"
if st.button(f"{audience['emoji']} {audience['name']}", key=audience_key,
help=f"Select {audience['name']} as your target audience",
use_container_width=True,
type="secondary" if st.session_state.selected_audience != audience else "primary"):
st.session_state.selected_audience = audience
st.markdown("</div></div>", unsafe_allow_html=True)
row4_col1, row4_col2 = st.columns(2)
with row4_col1:
st.markdown("### ๐ Select Format")
st.markdown("<div class='category-container'>", unsafe_allow_html=True)
st.markdown("<div class='button-container'>", unsafe_allow_html=True)
for i, format_item in enumerate(formats):
format_key = f"format_{i}"
if st.button(f"{format_item['emoji']} {format_item['name']}", key=format_key,
help=f"Select {format_item['name']} as your format",
use_container_width=True,
type="secondary" if st.session_state.selected_format != format_item else "primary"):
st.session_state.selected_format = format_item
st.markdown("</div></div>", unsafe_allow_html=True)
with row4_col2:
st.markdown("### ๐ Additional Details")
st.text_input("๐ฌ Topic (About)", key="about_input",
placeholder="Enter what the content should be about",
value=st.session_state.about,
on_change=lambda: setattr(st.session_state, 'about', st.session_state.about_input))
st.text_input("โ
Include", key="inclusion_input",
placeholder="What to include in the content",
value=st.session_state.inclusion,
on_change=lambda: setattr(st.session_state, 'inclusion', st.session_state.inclusion_input))
st.text_input("โ Exclude", key="exclusion_input",
placeholder="What to exclude from the content",
value=st.session_state.exclusion,
on_change=lambda: setattr(st.session_state, 'exclusion', st.session_state.exclusion_input))
st.text_area("๐ Input Data", key="input_data_input",
placeholder="Enter any specific information to use",
value=st.session_state.input_data,
on_change=lambda: setattr(st.session_state, 'input_data', st.session_state.input_data_input))
with col2:
st.markdown("<p class='section-title'>๐ฎ Generated Prompt</p>", unsafe_allow_html=True)
# Generate the prompt based on selections
prompt = ""
if (st.session_state.selected_role and st.session_state.selected_tone and
st.session_state.selected_instruction and st.session_state.selected_length and
st.session_state.selected_content_type and st.session_state.selected_audience and
st.session_state.selected_format and st.session_state.about):
prompt = f"""Act as a {st.session_state.selected_role['emoji']} {st.session_state.selected_role['name']}, use {st.session_state.selected_tone['emoji']} {st.session_state.selected_tone['name']} tone, {st.session_state.selected_instruction['emoji']} {st.session_state.selected_instruction['name']} a {st.session_state.selected_length['emoji']} {st.session_state.selected_length['name']} {st.session_state.selected_content_type['emoji']} {st.session_state.selected_content_type['name']} for {st.session_state.selected_audience['emoji']} {st.session_state.selected_audience['name']}.
It should be about {st.session_state.about}."""
if st.session_state.inclusion:
prompt += f"\nInclude {st.session_state.inclusion}."
if st.session_state.exclusion:
prompt += f"\nExclude {st.session_state.exclusion}."
prompt += f"\n\nReturn the output as {st.session_state.selected_format['emoji']} {st.session_state.selected_format['name']}."
if st.session_state.input_data:
prompt += f"\nUse the following information: {st.session_state.input_data}"
else:
prompt = "Please select all required options and provide a topic to generate a prompt."
st.markdown("<div class='prompt-display'>", unsafe_allow_html=True)
st.write(prompt)
st.markdown("</div>", unsafe_allow_html=True)
if prompt != "Please select all required options and provide a topic to generate a prompt.":
# Copy button
if st.button("๐ Copy Prompt", type="primary", use_container_width=True):
st.toast("Prompt copied to clipboard! ๐", icon="โ
")
# Reset button
if st.button("๐ Reset Fields", type="secondary", use_container_width=True):
st.session_state.selected_role = None
st.session_state.selected_tone = None
st.session_state.selected_instruction = None
st.session_state.selected_length = None
st.session_state.selected_content_type = None
st.session_state.selected_audience = None
st.session_state.selected_format = None
st.session_state.about = ""
st.session_state.inclusion = ""
st.session_state.exclusion = ""
st.session_state.input_data = ""
st.experimental_rerun()
# Random prompt generator
st.markdown("<br>", unsafe_allow_html=True)
st.markdown("<p class='section-title'>๐ฒ Need inspiration?</p>", unsafe_allow_html=True)
if st.button("๐ฒ Generate Random Prompt", type="secondary", use_container_width=True):
st.session_state.selected_role = random.choice(roles)
st.session_state.selected_tone = random.choice(tones)
st.session_state.selected_instruction = random.choice(instructions)
st.session_state.selected_length = random.choice(lengths)
st.session_state.selected_content_type = random.choice(content_types)
st.session_state.selected_audience = random.choice(audiences)
st.session_state.selected_format = random.choice(formats)
st.experimental_rerun()
# Prompt structure guide
st.markdown("<br>", unsafe_allow_html=True)
st.markdown("<p class='section-title'>๐ Prompt Structure Guide</p>", unsafe_allow_html=True)
st.markdown("""
<div class="highlight-box">
<p><strong>Basic Structure:</strong></p>
<p>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;">TARGET AUDIENCE</span>].</p>
<p>It should be about [<span style="color: gray;">TOPIC</span>].</p>
<p>Include [<span style="color: green;">INCLUSION</span>].</p>
<p>Exclude [<span style="color: red;">EXCLUSION</span>].</p>
<p>Return the output as [<span style="color: blue;">FORMAT</span>].</p>
<p>Use the following information: [<span style="color: purple;">INPUT DATA</span>]</p>
</div>
""", unsafe_allow_html=True)
with tab2:
st.markdown("<p class='section-title'>๐ Sample Prompts</p>", unsafe_allow_html=True)
# Display sample prompts in a 2x2 grid
col1, col2 = st.columns(2)
with col1:
# First sample
st.markdown(f"""
<div style="background-color: {sample_prompts[0]['color']}; border: 1px solid {sample_prompts[0]['border']}; border-radius: 10px; padding: 15px; margin-bottom: 20px;">
<h3>{sample_prompts[0]['title']}</h3>
<pre style="white-space: pre-wrap; font-family: 'Courier New', monospace; font-size: 14px;">{sample_prompts[0]['prompt']}</pre>
</div>
""", unsafe_allow_html=True)
# Third sample
st.markdown(f"""
<div style="background-color: {sample_prompts[2]['color']}; border: 1px solid {sample_prompts[2]['border']}; border-radius: 10px; padding: 15px;">
<h3>{sample_prompts[2]['title']}</h3>
<pre style="white-space: pre-wrap; font-family: 'Courier New', monospace; font-size: 14px;">{sample_prompts[2]['prompt']}</pre>
</div>
""", unsafe_allow_html=True)
with col2:
# Second sample
st.markdown(f"""
<div style="background-color: {sample_prompts[1]['color']}; border: 1px solid {sample_prompts[1]['border']}; border-radius: 10px; padding: 15px; margin-bottom: 20px;">
<h3>{sample_prompts[1]['title']}</h3>
<pre style="white-space: pre-wrap; font-family: 'Courier New', monospace; font-size: 14px;">{sample_prompts[1]['prompt']}</pre>
</div>
""", unsafe_allow_html=True)
# Fourth sample
st.markdown(f"""
<div style="background-color: {sample_prompts[3]['color']}; border: 1px solid {sample_prompts[3]['border']}; border-radius: 10px; padding: 15px;">
<h3>{sample_prompts[3]['title']}</h3>
<pre style="white-space: pre-wrap; font-family: 'Courier New', monospace; font-size: 14px;">{sample_prompts[3]['prompt']}</pre>
</div>
""", unsafe_allow_html=True)
with tab3:
st.markdown("<p class='section-title'>โน๏ธ About This App</p>", unsafe_allow_html=True)
st.markdown("""
<div class="highlight-box">
<h3>๐ง Gyula Rabai's ChatGPT Cheat Sheet</h3>
<p>This app is based on Gyula Rabai's excellent ChatGPT Cheat Sheet, which provides a structured approach to creating effective prompts for ChatGPT.</p>
<h4>How to Use This App:</h4>
<ol>
<li>Select components from each category (Role, Tone, Instruction, etc.)</li>
<li>Fill in the required fields (Topic, Include, Exclude, etc.)</li>
<li>View your generated prompt in real-time</li>
<li>Copy the prompt to use with ChatGPT</li>
</ol>
<h4>Benefits of Structured Prompts:</h4>
<ul>
<li>More precise and relevant responses</li>
<li>Better control over the AI's output format and style</li>
<li>Consistent results across different queries</li>
<li>Time-saving by reducing back-and-forth with the AI</li>
</ul>
<p>Original cheat sheet created by Gyula Rabai. More resources at <a href="https://szakai-server.com" target="_blank">szakai-server.com</a></p>
</div>
""", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
st.markdown("<p class='section-title'>๐ Prompt Components Statistics</p>", unsafe_allow_html=True)
# Generate some stats
stats_col1, stats_col2 = st.columns(2)
with stats_col1:
# Create a bar chart for roles distribution
roles_df = pd.DataFrame({
'Category': [r['name'] for r in roles[:8]],
'Count': [random.randint(5, 100) for _ in range(8)]
})
st.subheader("Most Popular Roles")
st.bar_chart(roles_df.set_index('Category'))
with stats_col2:
# Create a bar chart for content types distribution
content_df = pd.DataFrame({
'Category': [c['name'] for c in content_types[:8]],
'Count': [random.randint(5, 100) for _ in range(8)]
}) |