Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# Set page config
|
4 |
+
st.set_page_config(page_title="AI Prompt Enhancer", layout="centered")
|
5 |
+
|
6 |
+
# Dark/Light Mode Toggle
|
7 |
+
if "dark_mode" not in st.session_state:
|
8 |
+
st.session_state.dark_mode = False
|
9 |
+
|
10 |
+
def toggle_mode():
|
11 |
+
st.session_state.dark_mode = not st.session_state.dark_mode
|
12 |
+
|
13 |
+
# Apply Custom Styling
|
14 |
+
dark_css = """
|
15 |
+
<style>
|
16 |
+
body { background-color: #121212; color: #ffffff; }
|
17 |
+
.stTextArea, .stButton>button { background-color: #1e1e1e; color: #ffffff; }
|
18 |
+
.stButton>button { border-radius: 10px; font-size: 16px; padding: 10px 20px; }
|
19 |
+
</style>
|
20 |
+
"""
|
21 |
+
|
22 |
+
light_css = """
|
23 |
+
<style>
|
24 |
+
body { background-color: #f5f5f5; color: #000000; }
|
25 |
+
.stTextArea, .stButton>button { background-color: #ffffff; color: #000000; }
|
26 |
+
.stButton>button { border-radius: 10px; font-size: 16px; padding: 10px 20px; }
|
27 |
+
</style>
|
28 |
+
"""
|
29 |
+
|
30 |
+
# Apply selected mode
|
31 |
+
st.markdown(dark_css if st.session_state.dark_mode else light_css, unsafe_allow_html=True)
|
32 |
+
|
33 |
+
# Header
|
34 |
+
st.title("β¨ AI Prompt Enhancer")
|
35 |
+
|
36 |
+
# Dark Mode Toggle
|
37 |
+
st.sidebar.button("π Toggle Dark Mode" if not st.session_state.dark_mode else "βοΈ Toggle Light Mode", on_click=toggle_mode)
|
38 |
+
|
39 |
+
# Prompt Input Box
|
40 |
+
prompt = st.text_area("π‘ Prompt Idea Box", placeholder="Type your prompt here...")
|
41 |
+
|
42 |
+
# Category Selection
|
43 |
+
st.subheader("ποΈ Select an Enhancement Type")
|
44 |
+
|
45 |
+
categories = {
|
46 |
+
"π Copywriting": ["Ad Copy", "Blog Intro", "Product Description"],
|
47 |
+
"π» Code Generation": ["Python", "SQL", "Automation Scripts"],
|
48 |
+
"π§ Email & Outreach": ["Cold Emails", "Sales Pitches"],
|
49 |
+
"π Academic & Research": ["Essays", "Research Summaries"],
|
50 |
+
"π SEO Optimization": ["Keyword Rewrites", "Meta Descriptions"],
|
51 |
+
"π Creative Writing": ["Storytelling", "Poetry", "Social Media Posts"]
|
52 |
+
}
|
53 |
+
|
54 |
+
selected_category = st.selectbox("Choose a category:", list(categories.keys()))
|
55 |
+
|
56 |
+
# Display subcategories as buttons
|
57 |
+
selected_subcategory = st.radio("Choose an enhancement type:", categories[selected_category])
|
58 |
+
|
59 |
+
# Enhance Prompt Button
|
60 |
+
if st.button("π Enhance Prompt"):
|
61 |
+
st.write(f"πΉ **Enhanced Prompt for {selected_subcategory}:** [Prompt will be generated here]")
|