Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Prompt Recombobulator Deluxe 3000 - 9/28/2024 12:16 PM
|
2 |
+
|
3 |
+
st.markdown('''
|
4 |
+
|
5 |
+
# DK Tribute Educational Style Prompts for Various Themes
|
6 |
+
|
7 |
+
## 1. Interior Design Prompts
|
8 |
+
**Prompt**:
|
9 |
+
"๐๏ธ Design a sleek, minimalist living room with mid-century modern furniture. Feature a plush velvet sofa in emerald green, a walnut coffee table, and brass accents throughout. Large floor-to-ceiling windows bring in natural light, highlighting the indoor potted plants and abstract art on the walls."
|
10 |
+
|
11 |
+
**Score**: 9/10
|
12 |
+
---
|
13 |
+
|
14 |
+
## 2. Portrait Prompts
|
15 |
+
**Prompt**:
|
16 |
+
"๐งโ๐ฆฑ A regal portrait of a person with intricate facial tattoos, wearing a flowing silk robe. Their expression is serene, as they sit under the dappled light of an ancient oak tree. The wind gently moves their long hair, and behind them, a mountain range glows in the soft light of dawn."
|
17 |
+
|
18 |
+
**Score**: 8/10
|
19 |
+
---
|
20 |
+
|
21 |
+
## 3. Landscapes Prompts
|
22 |
+
**Prompt**:
|
23 |
+
"๐๏ธ A lush valley at sunrise, where a winding river reflects the pink and gold hues of the sky. Towering cliffs stand guard over a meadow of wildflowers in full bloom, while a lone eagle soars above. Mist rises from the forest below, blending with the soft morning light."
|
24 |
+
|
25 |
+
**Score**: 9.5/10
|
26 |
+
---
|
27 |
+
|
28 |
+
## 4. Science Fiction Prompts
|
29 |
+
**Prompt**:
|
30 |
+
"๐ฉโ๐ A futuristic cityscape where towering silver skyscrapers pierce the clouds. Hovering vehicles zoom through neon-lit airways, while giant holograms advertise interplanetary travel. In the distance, a massive spaceport sends ships off into the stars, with the planetโs twin moons looming overhead."
|
31 |
+
|
32 |
+
**Score**: 9/10
|
33 |
+
---
|
34 |
+
|
35 |
+
## 5. Fantasy Prompts
|
36 |
+
**Prompt**:
|
37 |
+
"๐ง In a mystical forest, glowing mushrooms line the path that leads to an enchanted waterfall. Fairy lights twinkle in the trees, and a grand crystal castle can be seen in the distance, half-hidden by mist. A lone wizard in a flowing robe walks towards the castle, his staff casting a soft blue glow."
|
38 |
+
|
39 |
+
**Score**: 9.5/10
|
40 |
+
---
|
41 |
+
|
42 |
+
## 6. Video Games Prompts
|
43 |
+
**Prompt**:
|
44 |
+
"๐น๏ธ A post-apocalyptic wasteland where towering, crumbling structures dominate the skyline. Players navigate through ruined cities overtaken by nature, encountering hostile robots and rogue factions. In the distance, a massive, glowing energy field threatens to engulf the last remnants of civilization."
|
45 |
+
|
46 |
+
**Score**: 8.5/10
|
47 |
+
---
|
48 |
+
|
49 |
+
|
50 |
+
''')
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
import streamlit as st
|
55 |
+
from transformers import pipeline, set_seed
|
56 |
+
import random
|
57 |
+
|
58 |
+
# Set random seed to make results reproducible (but where's the fun in that? ๐ฒ)
|
59 |
+
set_seed(42)
|
60 |
+
|
61 |
+
# Load the GPT-2 model for text generation
|
62 |
+
# ๐ค Initializing the AI overlord... I mean, assistant!
|
63 |
+
generator = pipeline('text-generation', model='gpt2')
|
64 |
+
|
65 |
+
# Title of the app
|
66 |
+
st.title("๐ Prompt Recombobulator Deluxe 3000")
|
67 |
+
|
68 |
+
# Description
|
69 |
+
st.write("Welcome to the Prompt Recombobulator Deluxe 3000! ๐คโจ")
|
70 |
+
st.write("Feeling uninspired? Let's mash some prompts together and see what creative chaos ensues! ๐")
|
71 |
+
|
72 |
+
# List of topics
|
73 |
+
topics = [
|
74 |
+
"Interior Design",
|
75 |
+
"Portrait",
|
76 |
+
"Landscapes",
|
77 |
+
"Science Fiction",
|
78 |
+
"Fantasy",
|
79 |
+
"Video Games",
|
80 |
+
"Cinema",
|
81 |
+
"Graphic Design",
|
82 |
+
"Illustration",
|
83 |
+
"Architecture",
|
84 |
+
"Fashion Design",
|
85 |
+
"Food"
|
86 |
+
]
|
87 |
+
|
88 |
+
# Sample prompts
|
89 |
+
sample_prompts = {
|
90 |
+
"Interior Design": "๐๏ธ Design a sleek, minimalist living room with mid-century modern furniture. Feature a plush velvet sofa in emerald green, a walnut coffee table, and brass accents throughout. Large floor-to-ceiling windows bring in natural light, highlighting the indoor potted plants and abstract art on the walls.",
|
91 |
+
"Portrait": "๐งโ๐ฆฑ A regal portrait of a person with intricate facial tattoos, wearing a flowing silk robe. Their expression is serene, as they sit under the dappled light of an ancient oak tree. The wind gently moves their long hair, and behind them, a mountain range glows in the soft light of dawn.",
|
92 |
+
"Landscapes": "๐๏ธ A lush valley at sunrise, where a winding river reflects the pink and gold hues of the sky. Towering cliffs stand guard over a meadow of wildflowers in full bloom, while a lone eagle soars above. Mist rises from the forest below, blending with the soft morning light.",
|
93 |
+
"Science Fiction": "๐ฉโ๐ A futuristic cityscape where towering silver skyscrapers pierce the clouds. Hovering vehicles zoom through neon-lit airways, while giant holograms advertise interplanetary travel. In the distance, a massive spaceport sends ships off into the stars, with the planetโs twin moons looming overhead.",
|
94 |
+
"Fantasy": "๐ง In a mystical forest, glowing mushrooms line the path that leads to an enchanted waterfall. Fairy lights twinkle in the trees, and a grand crystal castle can be seen in the distance, half-hidden by mist. A lone wizard in a flowing robe walks towards the castle, his staff casting a soft blue glow.",
|
95 |
+
"Video Games": "๐น๏ธ A post-apocalyptic wasteland where towering, crumbling structures dominate the skyline. Players navigate through ruined cities overtaken by nature, encountering hostile robots and rogue factions. In the distance, a massive, glowing energy field threatens to engulf the last remnants of civilization.",
|
96 |
+
"Cinema": "๐ฌ A dramatic scene where a lone detective walks through the rain-soaked streets of 1940s New York. Neon signs flicker in the background, and shadows hide the faces of passersby. The detective's trench coat and fedora are illuminated by the dim glow of street lamps as he approaches a smoky jazz club.",
|
97 |
+
"Graphic Design": "๐จ Create a bold and modern poster for an upcoming tech conference. Use geometric shapes, vibrant gradients, and minimalistic typography. Incorporate icons representing AI, blockchain, and cybersecurity in a cohesive layout that grabs attention.",
|
98 |
+
"Illustration": "๐๏ธ An imaginative illustration of a whimsical treehouse village connected by rope bridges. Each house is uniquely shaped, resembling mushrooms, teapots, and lanterns. Forest creatures like foxes and rabbits can be seen going about their day, adding a touch of magic to the scene.",
|
99 |
+
"Architecture": "๐๏ธ Design a futuristic eco-friendly skyscraper that incorporates vertical gardens and renewable energy sources. The building features sleek glass surfaces, wind turbines integrated into the structure, and open-air terraces that promote green living in an urban environment.",
|
100 |
+
"Fashion Design": "๐ Create a haute couture gown inspired by the ocean. The dress flows like waves, with layers of iridescent fabrics resembling shimmering water. Embellishments include pearls, seashells, and beadwork that mimic coral reefs. The design should evoke the beauty and mystery of the deep sea.",
|
101 |
+
"Food": "๐ฐ A decadent dessert table featuring an array of artisanal pastries. Macarons in pastel colors, miniature tarts topped with fresh berries, and a towering chocolate fountain surrounded by exotic fruits. The setup is elegant and enticing, perfect for a luxurious afternoon tea."
|
102 |
+
}
|
103 |
+
|
104 |
+
# Select a topic
|
105 |
+
topic = st.selectbox("Choose a theme ๐จ:", topics)
|
106 |
+
|
107 |
+
# Display the sample prompt
|
108 |
+
st.write("Here's a sample prompt for the selected theme:")
|
109 |
+
st.write(sample_prompts[topic])
|
110 |
+
|
111 |
+
# User input prompt
|
112 |
+
user_prompt = st.text_area("Or write your own prompt here:", sample_prompts[topic])
|
113 |
+
|
114 |
+
# Function to generate a new prompt
|
115 |
+
def generate_prompt(prompt_text):
|
116 |
+
"""Generate a new prompt based on the user's input prompt."""
|
117 |
+
# ๐ค Let's see what the AI chef cooks up! ๐จโ๐ณ
|
118 |
+
generated = generator(prompt_text, max_length=150, num_return_sequences=1)
|
119 |
+
return generated[0]['generated_text']
|
120 |
+
|
121 |
+
# Generate button
|
122 |
+
if st.button("Generate New Prompt ๐ฒ"):
|
123 |
+
# Add a fun message
|
124 |
+
st.write("Hold on to your socks, generating awesomeness... ๐งฆโจ")
|
125 |
+
with st.spinner("Cooking up some creative stew... ๐ฅฃ"):
|
126 |
+
new_prompt = generate_prompt(user_prompt)
|
127 |
+
st.success("Here's your recombobulated prompt! ๐")
|
128 |
+
st.write(new_prompt)
|
129 |
+
|
130 |
+
# Add an amusing comment based on topic
|
131 |
+
if topic == "Science Fiction":
|
132 |
+
st.write("๐ May the prompts be ever in your favor!")
|
133 |
+
elif topic == "Fantasy":
|
134 |
+
st.write("๐งโโ๏ธ You shall not pass... without a new prompt!")
|
135 |
+
elif topic == "Video Games":
|
136 |
+
st.write("๐ฎ Achievement unlocked: New Prompt Generated!")
|
137 |
+
elif topic == "Interior Design":
|
138 |
+
st.write("๐๏ธ Home is where the prompt is.")
|
139 |
+
elif topic == "Portrait":
|
140 |
+
st.write("๐๏ธ A picture is worth a thousand prompts.")
|
141 |
+
elif topic == "Landscapes":
|
142 |
+
st.write("๐ Keep calm and wander on.")
|
143 |
+
elif topic == "Cinema":
|
144 |
+
st.write("๐ฌ That's a wrap on your new prompt!")
|
145 |
+
elif topic == "Graphic Design":
|
146 |
+
st.write("๐จ Designing dreams one prompt at a time.")
|
147 |
+
elif topic == "Illustration":
|
148 |
+
st.write("๐๏ธ Sketching out some prompt perfection!")
|
149 |
+
elif topic == "Architecture":
|
150 |
+
st.write("๐๏ธ Building the future, one prompt at a time.")
|
151 |
+
elif topic == "Fashion Design":
|
152 |
+
st.write("๐ Your prompt just hit the runway!")
|
153 |
+
elif topic == "Food":
|
154 |
+
st.write("๐ด Bon appรฉtit! Your prompt is served.")
|
155 |
+
else:
|
156 |
+
st.write("โจ Enjoy your new prompt!")
|
157 |
+
|
158 |
+
# Footer
|
159 |
+
st.write("Made with โค๏ธ and a dash of code magic. โจ")
|