Spaces:
No application file
No application file
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,183 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import os
|
| 3 |
-
import sys
|
| 4 |
-
|
| 5 |
-
# Add current workspace directory to sys.path to allow absolute imports
|
| 6 |
-
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
| 7 |
-
|
| 8 |
-
from frontend.home import render_sidebar_brand, render_home_dashboard
|
| 9 |
-
from frontend.bg_remover_ui import render_bg_remover_ui
|
| 10 |
-
from frontend.text_editor_ui import render_text_editor_ui
|
| 11 |
-
from frontend.dslr_blur_ui import render_dslr_blur_ui
|
| 12 |
-
|
| 13 |
-
# Set Streamlit page config
|
| 14 |
-
st.set_page_config(
|
| 15 |
-
page_title="Antigravity Studio - AI Image & Document Workspace",
|
| 16 |
-
page_icon="⚡",
|
| 17 |
-
layout="wide",
|
| 18 |
-
initial_sidebar_state="expanded"
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
# Custom CSS for Glassmorphic Dark Theme with glowing neon accents
|
| 22 |
-
st.markdown(
|
| 23 |
-
"""
|
| 24 |
-
<style>
|
| 25 |
-
/* Import modern Google Fonts */
|
| 26 |
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 27 |
-
|
| 28 |
-
/* Apply fonts and background styles */
|
| 29 |
-
.stApp {
|
| 30 |
-
background-color: #0E1117;
|
| 31 |
-
font-family: 'Inter', sans-serif;
|
| 32 |
-
color: #E2E8F0;
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
/* Header Custom Styles */
|
| 36 |
-
.gradient-title {
|
| 37 |
-
font-family: 'Inter', sans-serif;
|
| 38 |
-
font-weight: 800;
|
| 39 |
-
font-size: 2.8rem;
|
| 40 |
-
background: linear-gradient(135deg, #00F0FF 0%, #FF007F 100%);
|
| 41 |
-
-webkit-background-clip: text;
|
| 42 |
-
-webkit-text-fill-color: transparent;
|
| 43 |
-
text-align: center;
|
| 44 |
-
margin-top: 10px;
|
| 45 |
-
margin-bottom: 5px;
|
| 46 |
-
letter-spacing: -1px;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
.subtitle {
|
| 50 |
-
text-align: center;
|
| 51 |
-
color: #8A99AD;
|
| 52 |
-
font-size: 1.1rem;
|
| 53 |
-
font-weight: 300;
|
| 54 |
-
margin-bottom: 30px;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
/* Glassmorphism Containers */
|
| 58 |
-
.glass-card {
|
| 59 |
-
background: rgba(255, 255, 255, 0.03);
|
| 60 |
-
border-radius: 16px;
|
| 61 |
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 62 |
-
padding: 24px;
|
| 63 |
-
backdrop-filter: blur(12px);
|
| 64 |
-
-webkit-backdrop-filter: blur(12px);
|
| 65 |
-
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
| 66 |
-
margin-bottom: 20px;
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
/* Upload UI wrapper */
|
| 70 |
-
.upload-container {
|
| 71 |
-
padding: 40px;
|
| 72 |
-
background: rgba(0, 240, 255, 0.01);
|
| 73 |
-
border: 1px dashed rgba(0, 240, 255, 0.3);
|
| 74 |
-
transition: all 0.3s ease;
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
.upload-container:hover {
|
| 78 |
-
border-color: #FF007F;
|
| 79 |
-
background: rgba(255, 0, 127, 0.01);
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
/* Custom Success Badge */
|
| 83 |
-
.success-badge {
|
| 84 |
-
background: rgba(0, 240, 255, 0.1);
|
| 85 |
-
color: #00F0FF;
|
| 86 |
-
border: 1px solid rgba(0, 240, 255, 0.2);
|
| 87 |
-
border-radius: 8px;
|
| 88 |
-
padding: 10px 15px;
|
| 89 |
-
font-size: 0.9rem;
|
| 90 |
-
margin: 15px 0;
|
| 91 |
-
text-align: center;
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
/* Labels and Headers */
|
| 95 |
-
.preview-label {
|
| 96 |
-
font-size: 0.8rem;
|
| 97 |
-
font-weight: 700;
|
| 98 |
-
letter-spacing: 1.5px;
|
| 99 |
-
color: #FF007F;
|
| 100 |
-
margin-bottom: 10px;
|
| 101 |
-
text-align: center;
|
| 102 |
-
text-transform: uppercase;
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
/* Custom Styled Sliders & Widgets in Sidebar */
|
| 106 |
-
[data-testid="stSidebar"] {
|
| 107 |
-
background-color: #0A0D14;
|
| 108 |
-
border-right: 1px solid rgba(255, 255, 255, 0.05);
|
| 109 |
-
}
|
| 110 |
-
|
| 111 |
-
[data-testid="stSidebar"] .stMarkdown h2, [data-testid="stSidebar"] .stMarkdown h3 {
|
| 112 |
-
color: #00F0FF;
|
| 113 |
-
font-weight: 600;
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
/* Streamlit buttons customized */
|
| 117 |
-
div.stButton > button {
|
| 118 |
-
background: linear-gradient(135deg, #00F0FF 0%, #7000FF 100%);
|
| 119 |
-
color: white;
|
| 120 |
-
border: none;
|
| 121 |
-
border-radius: 8px;
|
| 122 |
-
padding: 10px 24px;
|
| 123 |
-
font-weight: 600;
|
| 124 |
-
transition: all 0.2s ease-in-out;
|
| 125 |
-
box-shadow: 0 4px 15px rgba(0, 240, 255, 0.2);
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
div.stButton > button:hover {
|
| 129 |
-
background: linear-gradient(135deg, #FF007F 0%, #7000FF 100%);
|
| 130 |
-
transform: translateY(-2px);
|
| 131 |
-
box-shadow: 0 6px 20px rgba(255, 0, 127, 0.35);
|
| 132 |
-
color: white;
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
/* Glowing accents */
|
| 136 |
-
.glow-accent {
|
| 137 |
-
text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
</style>
|
| 141 |
-
""",
|
| 142 |
-
unsafe_allow_html=True
|
| 143 |
-
)
|
| 144 |
-
|
| 145 |
-
# ----------------- SESSION STATE INITIALIZATION -----------------
|
| 146 |
-
if "active_workspace" not in st.session_state:
|
| 147 |
-
st.session_state.active_workspace = "Home"
|
| 148 |
-
|
| 149 |
-
# ----------------- SIDEBAR BRANDING & ROUTING -----------------
|
| 150 |
-
render_sidebar_brand()
|
| 151 |
-
|
| 152 |
-
st.sidebar.markdown("### 🧭 NAVIGATION")
|
| 153 |
-
nav_choice = st.sidebar.selectbox(
|
| 154 |
-
"Active Workspace",
|
| 155 |
-
["Home Dashboard", "AI Background Remover", "AI DSLR Background Blur", "AI In-Image Text Editor"],
|
| 156 |
-
index=["Home Dashboard", "AI Background Remover", "AI DSLR Background Blur", "AI In-Image Text Editor"].index(
|
| 157 |
-
"Home Dashboard" if st.session_state.active_workspace == "Home" else st.session_state.active_workspace
|
| 158 |
-
),
|
| 159 |
-
key="nav_choice_select"
|
| 160 |
-
)
|
| 161 |
-
|
| 162 |
-
# Sync sidebar navigation selection with active session state
|
| 163 |
-
choice_mapped = "Home" if nav_choice == "Home Dashboard" else nav_choice
|
| 164 |
-
if choice_mapped != st.session_state.active_workspace:
|
| 165 |
-
st.session_state.active_workspace = choice_mapped
|
| 166 |
-
st.rerun()
|
| 167 |
-
|
| 168 |
-
# Quick nav back to Home from sidebar footer
|
| 169 |
-
st.sidebar.markdown("<br><br><br>", unsafe_allow_html=True)
|
| 170 |
-
if st.session_state.active_workspace != "Home":
|
| 171 |
-
if st.sidebar.button("← Back to Dashboard", use_container_width=True):
|
| 172 |
-
st.session_state.active_workspace = "Home"
|
| 173 |
-
st.rerun()
|
| 174 |
-
|
| 175 |
-
# ----------------- WORKSPACE RENDERING -----------------
|
| 176 |
-
if st.session_state.active_workspace == "Home":
|
| 177 |
-
render_home_dashboard()
|
| 178 |
-
elif st.session_state.active_workspace == "AI Background Remover":
|
| 179 |
-
render_bg_remover_ui()
|
| 180 |
-
elif st.session_state.active_work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