Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
projects = [
|
|
@@ -11,165 +13,261 @@ projects = [
|
|
| 11 |
|
| 12 |
css = """
|
| 13 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
| 14 |
-
|
| 15 |
-
/* MOBILE SCROLL FIXED + CENTER */
|
| 16 |
* {
|
| 17 |
-
font-family: 'Inter', sans-serif !important;
|
| 18 |
-
|
| 19 |
-
box-sizing: border-box !important;
|
| 20 |
-
max-width: 100% !important;
|
| 21 |
}
|
| 22 |
|
| 23 |
-
|
| 24 |
-
html, body, .gradio-container {
|
| 25 |
margin: 0 !important;
|
| 26 |
padding: 0 !important;
|
| 27 |
-
height: auto !important;
|
| 28 |
-
min-height: 100vh !important;
|
| 29 |
overflow-x: hidden !important;
|
| 30 |
-
overflow-y: auto !important;
|
| 31 |
-
-webkit-overflow-scrolling: touch !important;
|
| 32 |
-
background: linear-gradient(rgba(10,10,26,0.95), rgba(45,27,105,0.95)),
|
| 33 |
-
url('https://tse4.explicit.bing.net/th/id/OIP.CSOmF_Va1tPzTClwWuugnwHaEK?pid=Api&h=220&P=0') center/cover !important;
|
| 34 |
}
|
| 35 |
|
| 36 |
-
/*
|
| 37 |
-
.
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
text-align: center !important;
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
min-height: 100vh !important;
|
| 48 |
}
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
}
|
| 62 |
|
| 63 |
-
/*
|
| 64 |
.demo-btn {
|
| 65 |
-
background: linear-gradient(135deg, #ff6b6b, #feca57) !important;
|
|
|
|
|
|
|
| 66 |
color: white !important;
|
| 67 |
-
padding: 1rem 2rem !important;
|
| 68 |
-
border-radius: 12px !important;
|
| 69 |
-
text-decoration: none !important;
|
| 70 |
-
display: inline-block !important;
|
| 71 |
font-weight: 600 !important;
|
| 72 |
font-size: 1rem !important;
|
| 73 |
-
|
| 74 |
-
|
|
|
|
| 75 |
margin: 1rem auto !important;
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
border-radius: 16px !important;
|
| 85 |
-
|
| 86 |
margin: 1rem auto !important;
|
| 87 |
-
max-width: 95% !important;
|
| 88 |
}
|
| 89 |
|
| 90 |
-
/*
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
| 97 |
}
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
}
|
| 104 |
-
|
|
|
|
|
|
|
| 105 |
display: flex !important;
|
| 106 |
-
flex-
|
|
|
|
|
|
|
| 107 |
justify-content: center !important;
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
}
|
| 111 |
-
.tab-button {
|
| 112 |
-
color: white !important;
|
| 113 |
-
background: rgba(255,255,255,0.1) !important;
|
| 114 |
-
border: 1px solid rgba(255,255,255,0.3) !important;
|
| 115 |
-
margin: 0.2rem !important;
|
| 116 |
-
padding: 0.8rem 1rem !important;
|
| 117 |
-
white-space: nowrap !important;
|
| 118 |
-
min-height: 44px !important;
|
| 119 |
-
flex: 0 0 auto !important;
|
| 120 |
}
|
| 121 |
|
| 122 |
-
/*
|
| 123 |
@media (max-width: 768px) {
|
| 124 |
-
.
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
}
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
| 137 |
}
|
| 138 |
"""
|
| 139 |
|
| 140 |
-
with gr.Blocks(
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
gr.Markdown(
|
| 143 |
"# ✨ **AI/ML Projects**\n\n**6 Production-Ready Projects • Live on Hugging Face**",
|
| 144 |
elem_classes="header-gradient glass-card center-content"
|
| 145 |
)
|
| 146 |
|
| 147 |
-
|
| 148 |
-
with gr.Tabs(elem_classes="center-content"):
|
| 149 |
for proj in projects:
|
| 150 |
-
with gr.TabItem(proj["name"]):
|
| 151 |
-
with gr.Column(elem_classes="glass-card center-content"):
|
| 152 |
gr.Markdown(f"# 🚀 **{proj['name']}**")
|
| 153 |
gr.Markdown(f"**📝 {proj['desc']}**")
|
| 154 |
-
gr.Markdown(f"**🛠️ Tech Stack:** {' • '.join(proj['skills'])}")
|
| 155 |
|
| 156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
gr.HTML(f'''
|
| 158 |
-
<
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
</a>
|
| 162 |
-
</div>
|
| 163 |
''')
|
| 164 |
|
| 165 |
-
# VIDEO
|
| 166 |
gr.Video(
|
| 167 |
value=proj["video"],
|
| 168 |
-
label=
|
| 169 |
-
height=
|
|
|
|
| 170 |
interactive=False,
|
| 171 |
-
|
| 172 |
-
elem_classes="playable-video"
|
| 173 |
)
|
| 174 |
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
!pip install gradio==5.4.1 -q
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
projects = [
|
|
|
|
| 13 |
|
| 14 |
css = """
|
| 15 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
|
|
|
|
|
|
| 16 |
* {
|
| 17 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
|
| 18 |
+
box-sizing: border-box;
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
+
body, .gradio-container {
|
|
|
|
| 22 |
margin: 0 !important;
|
| 23 |
padding: 0 !important;
|
|
|
|
|
|
|
| 24 |
overflow-x: hidden !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
+
/* Consistent glassmorphism across all themes */
|
| 28 |
+
.glass-card {
|
| 29 |
+
background: rgba(255, 255, 255, 0.12) !important;
|
| 30 |
+
backdrop-filter: blur(20px) saturate(180%) !important;
|
| 31 |
+
-webkit-backdrop-filter: blur(20px) saturate(180%) !important;
|
| 32 |
+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 33 |
+
border-radius: 20px !important;
|
| 34 |
+
box-shadow:
|
| 35 |
+
0 8px 32px rgba(0, 0, 0, 0.15),
|
| 36 |
+
inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
|
| 37 |
+
position: relative !important;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.glass-card::before {
|
| 41 |
+
content: '';
|
| 42 |
+
position: absolute;
|
| 43 |
+
top: 0;
|
| 44 |
+
left: 0;
|
| 45 |
+
right: 0;
|
| 46 |
+
bottom: 0;
|
| 47 |
+
border-radius: 20px;
|
| 48 |
+
padding: 2px;
|
| 49 |
+
background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
|
| 50 |
+
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
| 51 |
+
mask-composite: exclude;
|
| 52 |
+
-webkit-mask-composite: xor;
|
| 53 |
+
pointer-events: none;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/* Universal gradient header */
|
| 57 |
+
.header-gradient {
|
| 58 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
|
| 59 |
+
border-radius: 20px !important;
|
| 60 |
+
padding: 2.5rem 2rem !important;
|
| 61 |
text-align: center !important;
|
| 62 |
+
box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3) !important;
|
| 63 |
+
margin: 1.5rem auto !important;
|
| 64 |
+
position: relative;
|
| 65 |
+
overflow: hidden;
|
|
|
|
| 66 |
}
|
| 67 |
|
| 68 |
+
.header-gradient::after {
|
| 69 |
+
content: '';
|
| 70 |
+
position: absolute;
|
| 71 |
+
top: -50%;
|
| 72 |
+
left: -50%;
|
| 73 |
+
width: 200%;
|
| 74 |
+
height: 200%;
|
| 75 |
+
background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
|
| 76 |
+
animation: shine 3s infinite;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
@keyframes shine {
|
| 80 |
+
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
|
| 81 |
+
100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
|
| 82 |
}
|
| 83 |
|
| 84 |
+
/* Demo button - consistent across themes */
|
| 85 |
.demo-btn {
|
| 86 |
+
background: linear-gradient(135deg, #ff6b6b, #feca57, #ff9ff3) !important;
|
| 87 |
+
border: none !important;
|
| 88 |
+
border-radius: 16px !important;
|
| 89 |
color: white !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
font-weight: 600 !important;
|
| 91 |
font-size: 1rem !important;
|
| 92 |
+
padding: 1rem 2rem !important;
|
| 93 |
+
width: 100% !important;
|
| 94 |
+
max-width: 320px !important;
|
| 95 |
margin: 1rem auto !important;
|
| 96 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 97 |
+
text-decoration: none !important;
|
| 98 |
+
display: inline-flex !important;
|
| 99 |
+
align-items: center;
|
| 100 |
+
justify-content: center;
|
| 101 |
+
gap: 0.5rem;
|
| 102 |
+
position: relative;
|
| 103 |
+
overflow: hidden;
|
| 104 |
+
text-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
| 105 |
}
|
| 106 |
|
| 107 |
+
.demo-btn::before {
|
| 108 |
+
content: '';
|
| 109 |
+
position: absolute;
|
| 110 |
+
top: 0;
|
| 111 |
+
left: -100%;
|
| 112 |
+
width: 100%;
|
| 113 |
+
height: 100%;
|
| 114 |
+
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
| 115 |
+
transition: left 0.5s;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.demo-btn:hover::before {
|
| 119 |
+
left: 100%;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.demo-btn:hover {
|
| 123 |
+
transform: translateY(-2px) scale(1.02) !important;
|
| 124 |
+
box-shadow: 0 15px 35px rgba(255, 107, 107, 0.4) !important;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/* Video styling */
|
| 128 |
+
.video-medium {
|
| 129 |
+
width: 100% !important;
|
| 130 |
+
max-width: 700px !important;
|
| 131 |
+
height: 300px !important;
|
| 132 |
border-radius: 16px !important;
|
| 133 |
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2) !important;
|
| 134 |
margin: 1rem auto !important;
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
+
/* Typography consistency */
|
| 138 |
+
h1, h2, h3 {
|
| 139 |
+
font-weight: 700 !important;
|
| 140 |
+
background: linear-gradient(135deg, #ffffff, #e0e7ff) !important;
|
| 141 |
+
-webkit-background-clip: text !important;
|
| 142 |
+
-webkit-text-fill-color: transparent !important;
|
| 143 |
+
background-clip: text !important;
|
| 144 |
+
margin: 0.5rem 0 !important;
|
| 145 |
}
|
| 146 |
|
| 147 |
+
p, .prose {
|
| 148 |
+
color: inherit !important;
|
| 149 |
+
opacity: 0.95 !important;
|
| 150 |
+
line-height: 1.6 !important;
|
| 151 |
}
|
| 152 |
+
|
| 153 |
+
/* Center content */
|
| 154 |
+
.center-content {
|
| 155 |
display: flex !important;
|
| 156 |
+
flex-direction: column !important;
|
| 157 |
+
align-items: center !important;
|
| 158 |
+
text-align: center !important;
|
| 159 |
justify-content: center !important;
|
| 160 |
+
padding: 2rem 1rem !important;
|
| 161 |
+
gap: 1.5rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
}
|
| 163 |
|
| 164 |
+
/* Responsive breakpoints */
|
| 165 |
@media (max-width: 768px) {
|
| 166 |
+
.header-gradient {
|
| 167 |
+
padding: 2rem 1.5rem !important;
|
| 168 |
+
margin: 1rem 0.5rem !important;
|
| 169 |
+
border-radius: 16px !important;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
.demo-btn {
|
| 173 |
+
padding: 0.9rem 1.5rem !important;
|
| 174 |
+
font-size: 0.95rem !important;
|
| 175 |
+
max-width: 280px !important;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
.video-medium {
|
| 179 |
+
height: 250px !important;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.glass-card {
|
| 183 |
+
margin: 0.5rem !important;
|
| 184 |
+
border-radius: 16px !important;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
.center-content {
|
| 188 |
+
padding: 1.5rem 1rem !important;
|
| 189 |
+
gap: 1rem !important;
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
@media (max-width: 480px) {
|
| 194 |
+
.video-medium { height: 220px !important; }
|
| 195 |
+
.demo-btn { padding: 0.8rem 1.2rem !important; font-size: 0.9rem !important; }
|
| 196 |
+
h1 { font-size: 1.8rem !important; }
|
| 197 |
+
h2 { font-size: 1.4rem !important; }
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
/* Tab improvements */
|
| 201 |
+
.tabitem {
|
| 202 |
+
padding: 1rem !important;
|
| 203 |
+
margin: 0 !important;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.tabitem > div {
|
| 207 |
+
max-width: 100% !important;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
/* Skill badges */
|
| 211 |
+
.skills {
|
| 212 |
+
display: flex !important;
|
| 213 |
+
flex-wrap: wrap !important;
|
| 214 |
+
gap: 0.5rem !important;
|
| 215 |
+
justify-content: center !important;
|
| 216 |
}
|
| 217 |
|
| 218 |
+
.skill-badge {
|
| 219 |
+
background: rgba(255, 255, 255, 0.15) !important;
|
| 220 |
+
padding: 0.4rem 1rem !important;
|
| 221 |
+
border-radius: 20px !important;
|
| 222 |
+
font-size: 0.85rem !important;
|
| 223 |
+
font-weight: 500 !important;
|
| 224 |
+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 225 |
}
|
| 226 |
"""
|
| 227 |
|
| 228 |
+
with gr.Blocks(
|
| 229 |
+
css=css,
|
| 230 |
+
theme=gr.themes.Soft(),
|
| 231 |
+
fill_height=True
|
| 232 |
+
) as demo:
|
| 233 |
+
|
| 234 |
gr.Markdown(
|
| 235 |
"# ✨ **AI/ML Projects**\n\n**6 Production-Ready Projects • Live on Hugging Face**",
|
| 236 |
elem_classes="header-gradient glass-card center-content"
|
| 237 |
)
|
| 238 |
|
| 239 |
+
with gr.Tabs(elem_classes="glass-card") as tabs:
|
|
|
|
| 240 |
for proj in projects:
|
| 241 |
+
with gr.TabItem(proj["name"], elem_classes="glass-card"):
|
| 242 |
+
with gr.Column(elem_classes="glass-card center-content", scale=1):
|
| 243 |
gr.Markdown(f"# 🚀 **{proj['name']}**")
|
| 244 |
gr.Markdown(f"**📝 {proj['desc']}**")
|
|
|
|
| 245 |
|
| 246 |
+
with gr.Row():
|
| 247 |
+
gr.Markdown(f"**🛠️ Tech Stack:**")
|
| 248 |
+
skills_md = " ".join([f'<span class="skill-badge">{skill}</span>' for skill in proj["skills"]])
|
| 249 |
+
gr.HTML(skills_md)
|
| 250 |
+
|
| 251 |
gr.HTML(f'''
|
| 252 |
+
<a href="{proj["live"]}" target="_blank" class="demo-btn">
|
| 253 |
+
🎮 Launch {proj['name']} Live Demo
|
| 254 |
+
</a>
|
|
|
|
|
|
|
| 255 |
''')
|
| 256 |
|
|
|
|
| 257 |
gr.Video(
|
| 258 |
value=proj["video"],
|
| 259 |
+
label="📹 Project Demo",
|
| 260 |
+
height=300,
|
| 261 |
+
show_download_button=True,
|
| 262 |
interactive=False,
|
| 263 |
+
elem_classes="video-medium"
|
|
|
|
| 264 |
)
|
| 265 |
|
| 266 |
+
# Optimized for Hugging Face Spaces
|
| 267 |
+
demo.launch(
|
| 268 |
+
share=True,
|
| 269 |
+
debug=True,
|
| 270 |
+
show_error=True,
|
| 271 |
+
height="auto",
|
| 272 |
+
enable_queue=True
|
| 273 |
+
)
|