Spaces:
Sleeping
Sleeping
File size: 8,229 Bytes
8e9d447 |
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 |
import streamlit as st
import pandas as pd
import random
import itertools
import emoji
# Set page config
st.set_page_config(
page_title="๐ฐ Prompt Universe Generator",
layout="wide",
initial_sidebar_state="expanded"
)
# Custom CSS
st.markdown("""
<style>
.stButton > button {
background-color: #4CAF50;
color: white;
font-size: 16px;
padding: 15px 30px;
border-radius: 10px;
border: none;
}
.slot-machine {
background-color: #f0f2f6;
padding: 20px;
border-radius: 10px;
margin: 10px 0;
}
.category-header {
font-size: 24px;
font-weight: bold;
margin: 20px 0;
}
</style>
""", unsafe_allow_html=True)
# Define our expanded categories with emoji themes
PROMPT_CATEGORIES = {
"โจ Magical Realms": {
"prompts": [
"ethereal crystalline monarch | 8k hyperdetailed cinematic | bioluminescent highlights",
"neo-victorian cyberpunk teahouse | volumetric fog | copper accents",
"fractalized coral reef dreamscape | pearl iridescence | fluid dynamics",
"astral wolf constellation | cosmic dust | northern lights palette",
"art nouveau forest spirit | golden hour | dewdrop details",
"quantum mechanical butterfly | holographic wings | infrared spectrum",
"volcanic glass sculpture | obsidian reflections | ember glow",
"time-worn steampunk clocktower | brass patina | morning mist",
"deep sea biopunk garden | phosphorescent jellies | aquatic currents",
"frost giant's library | ice crystal formations | aurora ambient lighting"
],
"emoji": "๐"
},
"๐จ Color Harmonies": {
"prompts": [
"Crimson and Onyx | dark cathedral architecture | obsidian reflections",
"Emerald and Antique Gold | overgrown temple ruins | dappled sunlight",
"Royal Purple and Solar Gold | cosmic throne room | nebula wisps",
"Sapphire and Silver | frozen palace | moonlight refractions",
"Amber and Midnight Blue | twilight desert palace | star trails",
"Jade and Bronze | ancient forest sanctuary | morning mist",
"Ruby and Platinum | dragon's treasure vault | gemstone reflections",
"Amethyst and Pearl | ethereal spirit realm | iridescent fog",
"Copper and Teal | oceanic steampunk | patina patterns",
"Ivory and Blood Red | samurai dojo | cherry blossom storm"
],
"emoji": "๐ญ"
},
"๐ผ๏ธ Artistic Masters": {
"prompts": [
"Bosch's Garden of Delights | mechanical hybrid creatures | crystalline pools",
"Zaha Hadid | flowing parametric curves | chrome and glass",
"Klimt's Golden Phase | art nouveau patterns | metallic leaf textures",
"Frank Gehry | deconstructed titanium surfaces | sunset reflections",
"Dali's Melting World | liquid clocks | desert mirage effects",
"Jeff Koons | balloon animal metallic | perfect reflection mapping",
"Gaudi's Organic Forms | mosaic textures | Mediterranean light",
"Alphonse Mucha | art nouveau female figures | flowing hair details",
"Frank Lloyd Wright | prairie style geometry | stained glass lighting",
"HR Giger | biomechanical corridors | dark chrome details"
],
"emoji": "๐จโ๐จ"
},
"๐ Quantum Vehicles": {
"prompts": [
"Quantum Glass Semi-House | aerodynamic living quarters | transparent structural planes",
"Levitating Truck Platform | crystalline habitat modules | floating staircase connectivity",
"Metamaterial Highway Manor | prismatic solar walls | flowing energy conduits",
"Transparent Titanium Hauler | modular living pods | geometric strength patterns",
"Photonic Crystal Cabin | light-filtering smart glass | suspended garden terrace",
"Nano-reinforced Road Palace | panoramic plexiglass shell | flowing interior levels",
"Quantum-Strengthened Caravan | transparent load-bearing walls | floating deck design",
"Biomimetic Transport Home | adaptive opacity glass | organic support structures",
"Holographic Highway Home | diamond-matrix viewport | suspended living spaces",
"Molecular-Perfect Transport | clear carbon construction | anti-gravity aesthetics"
],
"emoji": "๐ฎ"
}
}
def generate_random_combination():
"""Generate a random combination from each category"""
combination = []
for category in PROMPT_CATEGORIES.values():
combination.append(random.choice(category["prompts"]))
return combination
def create_prompt_dataframe():
"""Create a DataFrame with all possible combinations"""
all_combinations = list(itertools.product(*[cat["prompts"] for cat in PROMPT_CATEGORIES.values()]))
df = pd.DataFrame(all_combinations, columns=list(PROMPT_CATEGORIES.keys()))
return df
# Initialize session state
if 'generated_prompts' not in st.session_state:
st.session_state.generated_prompts = []
# Title and description
st.title("๐ฐ Prompt Universe Generator")
st.markdown("### Where Imagination Meets Infinite Possibilities!")
# Sidebar controls
st.sidebar.header("๐ฎ Control Panel")
selected_categories = st.sidebar.multiselect(
"Choose Categories to Include",
list(PROMPT_CATEGORIES.keys()),
default=list(PROMPT_CATEGORIES.keys())
)
# Create main tabs
tab1, tab2, tab3 = st.tabs(["๐ฒ Prompt Slot Machine", "๐ Prompt Workshop", "๐ Prompt Explorer"])
with tab1:
if st.button("๐ฐ Spin the Wheels of Creation!", key="slot_machine"):
combination = []
for category in selected_categories:
prompt = random.choice(PROMPT_CATEGORIES[category]["prompts"])
combination.append(prompt)
st.session_state.generated_prompts.append(combination)
# Display in a grid
cols = st.columns(len(selected_categories))
for i, (category, prompt) in enumerate(zip(selected_categories, combination)):
with cols[i]:
st.markdown(f"### {category}")
st.markdown(f"**{prompt}**")
# Final combined prompt
st.markdown("### ๐จ Combined Prompt:")
final_prompt = " || ".join(combination)
st.code(final_prompt, language="markdown")
with tab2:
st.markdown("### ๐ ๏ธ Custom Prompt Workshop")
# Create an editable dataframe of recent generations
if st.session_state.generated_prompts:
df = pd.DataFrame(st.session_state.generated_prompts, columns=selected_categories)
edited_df = st.data_editor(
df,
num_rows="dynamic",
use_container_width=True,
key="prompt_editor"
)
if st.button("๐ซ Generate from Selection"):
selected_prompt = " || ".join(edited_df.iloc[0].values)
st.code(selected_prompt, language="markdown")
with tab3:
st.markdown("### ๐ฎ Explore All Possibilities")
# Category viewer
category = st.selectbox("Choose a Category to Explore", list(PROMPT_CATEGORIES.keys()))
if category:
st.markdown(f"### {PROMPT_CATEGORIES[category]['emoji']} {category} Prompts")
for prompt in PROMPT_CATEGORIES[category]["prompts"]:
st.markdown(f"- {prompt}")
# Random sampler
if st.button("๐ฒ Sample Random Combination"):
random_prompts = generate_random_combination()
st.code(" || ".join(random_prompts), language="markdown")
# Footer with tips
st.markdown("---")
st.markdown("### ๐ Pro Tips")
st.markdown("""
* Combine prompts from different categories for unique results
* Use the workshop to fine-tune your combinations
* Save your favorite prompts by copying them
* Experiment with different category combinations
* Add quality specifiers like '8k upscale' to any prompt
""")
# Credits
st.sidebar.markdown("---")
st.sidebar.markdown("### ๐จ Prompt Categories")
for category, data in PROMPT_CATEGORIES.items():
st.sidebar.markdown(f"{data['emoji']} {category}") |