Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
projects = [
|
|
@@ -13,7 +12,7 @@ projects = [
|
|
| 13 |
css = """
|
| 14 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
| 15 |
|
| 16 |
-
/* PERFECT
|
| 17 |
.gradio-container {
|
| 18 |
background: linear-gradient(rgba(10,10,26,0.92), rgba(45,27,105,0.92)),
|
| 19 |
url('https://tse4.explicit.bing.net/th/id/OIP.CSOmF_Va1tPzTClwWuugnwHaEK?pid=Api&h=220&P=0') center/cover no-repeat !important;
|
|
@@ -21,7 +20,6 @@ css = """
|
|
| 21 |
min-height: 100vh !important;
|
| 22 |
color: white !important;
|
| 23 |
padding: 0 !important;
|
| 24 |
-
margin: 0 !important;
|
| 25 |
}
|
| 26 |
|
| 27 |
/* WHITE TEXT EVERYWHERE */
|
|
@@ -31,14 +29,7 @@ css = """
|
|
| 31 |
background: transparent !important;
|
| 32 |
}
|
| 33 |
|
| 34 |
-
/* MOBILE SCROLL
|
| 35 |
-
html, body {
|
| 36 |
-
overflow-x: hidden !important;
|
| 37 |
-
overflow-y: auto !important;
|
| 38 |
-
height: 100% !important;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
/* PERFECT CENTERING */
|
| 42 |
.center-content {
|
| 43 |
display: flex !important;
|
| 44 |
flex-direction: column !important;
|
|
@@ -46,10 +37,7 @@ html, body {
|
|
| 46 |
justify-content: flex-start !important;
|
| 47 |
text-align: center !important;
|
| 48 |
width: 100% !important;
|
| 49 |
-
max-width: 100% !important;
|
| 50 |
-
margin: 0 auto !important;
|
| 51 |
padding: 1rem !important;
|
| 52 |
-
min-height: 100vh !important;
|
| 53 |
box-sizing: border-box !important;
|
| 54 |
}
|
| 55 |
|
|
@@ -90,10 +78,9 @@ html, body {
|
|
| 90 |
box-shadow: 0 20px 40px rgba(255, 107, 107, 0.6) !important;
|
| 91 |
}
|
| 92 |
|
| 93 |
-
/*
|
| 94 |
.video-container {
|
| 95 |
width: 100% !important;
|
| 96 |
-
max-width: 100% !important;
|
| 97 |
margin: 1rem 0 !important;
|
| 98 |
}
|
| 99 |
.video-container video {
|
|
@@ -102,7 +89,6 @@ html, body {
|
|
| 102 |
max-height: 350px !important;
|
| 103 |
border-radius: 16px !important;
|
| 104 |
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
|
| 105 |
-
display: block !important;
|
| 106 |
}
|
| 107 |
|
| 108 |
/* HEADER */
|
|
@@ -114,55 +100,23 @@ html, body {
|
|
| 114 |
box-shadow: 0 25px 50px rgba(102, 126, 234, 0.5) !important;
|
| 115 |
margin: 2rem auto !important;
|
| 116 |
max-width: 90% !important;
|
| 117 |
-
color: white !important;
|
| 118 |
}
|
| 119 |
|
| 120 |
-
/* TABS
|
| 121 |
-
.gradio-tabs, .tab-header, .tab-content, .tab-button {
|
| 122 |
-
|
| 123 |
-
background: transparent !important;
|
| 124 |
-
}
|
| 125 |
-
.tab-item {
|
| 126 |
-
color: white !important;
|
| 127 |
-
min-height: 60vh !important;
|
| 128 |
-
}
|
| 129 |
|
| 130 |
-
/* MOBILE PERFECTION */
|
| 131 |
@media (max-width: 768px) {
|
| 132 |
-
.
|
| 133 |
-
.
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
overflow-y: auto !important;
|
| 138 |
-
}
|
| 139 |
-
.demo-btn {
|
| 140 |
-
padding: 1rem 1.5rem !important;
|
| 141 |
-
font-size: 1rem !important;
|
| 142 |
-
max-width: 90vw !important;
|
| 143 |
-
}
|
| 144 |
-
.video-container video {
|
| 145 |
-
max-height: 280px !important;
|
| 146 |
-
width: 100% !important;
|
| 147 |
-
height: auto !important;
|
| 148 |
-
}
|
| 149 |
-
.header-gradient {
|
| 150 |
-
padding: 2rem 1rem !important;
|
| 151 |
-
margin: 1rem 0 !important;
|
| 152 |
-
max-width: 95vw !important;
|
| 153 |
-
}
|
| 154 |
-
.glass-card {
|
| 155 |
-
padding: 1.5rem 1rem !important;
|
| 156 |
-
margin: 0.5rem 0 !important;
|
| 157 |
-
}
|
| 158 |
-
.tab-item { min-height: 70vh !important; }
|
| 159 |
}
|
| 160 |
-
|
| 161 |
-
/* PREVENT HORIZONTAL SCROLL */
|
| 162 |
-
* { max-width: 100% !important; box-sizing: border-box !important; }
|
| 163 |
"""
|
| 164 |
|
| 165 |
-
|
|
|
|
| 166 |
# HEADER
|
| 167 |
with gr.Column(elem_classes="center-content"):
|
| 168 |
gr.Markdown(
|
|
@@ -170,34 +124,34 @@ with gr.Blocks(css=css, height=1000) as demo:
|
|
| 170 |
elem_classes="header-gradient glass-card"
|
| 171 |
)
|
| 172 |
|
| 173 |
-
# TABS
|
| 174 |
with gr.Tabs(elem_classes="center-content"):
|
| 175 |
for proj in projects:
|
| 176 |
with gr.TabItem(proj["name"]):
|
| 177 |
with gr.Column(elem_classes="glass-card center-content"):
|
| 178 |
-
#
|
| 179 |
-
gr.Markdown(f"
|
| 180 |
-
|
| 181 |
-
# DESCRIPTION
|
| 182 |
-
gr.Markdown(f"**📝 {proj['desc']}**", elem_classes="center-content")
|
| 183 |
-
|
| 184 |
-
# SKILLS
|
| 185 |
-
gr.Markdown(f"**🛠️ Tech Stack:** {' • '.join(proj['skills'])}", elem_classes="center-content")
|
| 186 |
|
| 187 |
-
# BUTTON + VIDEO
|
| 188 |
gr.HTML(f'''
|
| 189 |
-
<div style="width:100%; text-align:center;
|
| 190 |
-
<a href="{proj['live']}" target="_blank" class="demo-btn" style="text-decoration:none;
|
| 191 |
🎮 Launch {proj['name']} Live Demo
|
| 192 |
</a>
|
| 193 |
<div class="video-container">
|
| 194 |
<video controls preload="metadata"
|
| 195 |
-
style="width:100%; height:auto; max-height:350px; border-radius:16px; margin-top:1rem; box-shadow:0 20px 40px rgba(0,0,0,0.4);
|
| 196 |
<source src="{proj['video']}" type="video/mp4">
|
| 197 |
-
Your browser doesn't support video
|
| 198 |
</video>
|
| 199 |
</div>
|
| 200 |
</div>
|
| 201 |
''')
|
| 202 |
|
| 203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
projects = [
|
|
|
|
| 12 |
css = """
|
| 13 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
| 14 |
|
| 15 |
+
/* PERFECT HF SPACES BACKGROUND */
|
| 16 |
.gradio-container {
|
| 17 |
background: linear-gradient(rgba(10,10,26,0.92), rgba(45,27,105,0.92)),
|
| 18 |
url('https://tse4.explicit.bing.net/th/id/OIP.CSOmF_Va1tPzTClwWuugnwHaEK?pid=Api&h=220&P=0') center/cover no-repeat !important;
|
|
|
|
| 20 |
min-height: 100vh !important;
|
| 21 |
color: white !important;
|
| 22 |
padding: 0 !important;
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
/* WHITE TEXT EVERYWHERE */
|
|
|
|
| 29 |
background: transparent !important;
|
| 30 |
}
|
| 31 |
|
| 32 |
+
/* MOBILE SCROLL + CENTER */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
.center-content {
|
| 34 |
display: flex !important;
|
| 35 |
flex-direction: column !important;
|
|
|
|
| 37 |
justify-content: flex-start !important;
|
| 38 |
text-align: center !important;
|
| 39 |
width: 100% !important;
|
|
|
|
|
|
|
| 40 |
padding: 1rem !important;
|
|
|
|
| 41 |
box-sizing: border-box !important;
|
| 42 |
}
|
| 43 |
|
|
|
|
| 78 |
box-shadow: 0 20px 40px rgba(255, 107, 107, 0.6) !important;
|
| 79 |
}
|
| 80 |
|
| 81 |
+
/* VIDEOS */
|
| 82 |
.video-container {
|
| 83 |
width: 100% !important;
|
|
|
|
| 84 |
margin: 1rem 0 !important;
|
| 85 |
}
|
| 86 |
.video-container video {
|
|
|
|
| 89 |
max-height: 350px !important;
|
| 90 |
border-radius: 16px !important;
|
| 91 |
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
/* HEADER */
|
|
|
|
| 100 |
box-shadow: 0 25px 50px rgba(102, 126, 234, 0.5) !important;
|
| 101 |
margin: 2rem auto !important;
|
| 102 |
max-width: 90% !important;
|
|
|
|
| 103 |
}
|
| 104 |
|
| 105 |
+
/* TABS + MOBILE */
|
| 106 |
+
.gradio-tabs, .tab-header, .tab-content, .tab-button { color: white !important; }
|
| 107 |
+
.tab-item { min-height: 60vh !important; color: white !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
|
|
|
| 109 |
@media (max-width: 768px) {
|
| 110 |
+
.center-content { padding: 1rem !important; width: 100vw !important; }
|
| 111 |
+
.demo-btn { padding: 1rem 1.5rem !important; font-size: 1rem !important; max-width: 90vw !important; }
|
| 112 |
+
.video-container video { max-height: 280px !important; }
|
| 113 |
+
.header-gradient { padding: 2rem 1rem !important; max-width: 95vw !important; }
|
| 114 |
+
.glass-card { padding: 1.5rem 1rem !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
}
|
|
|
|
|
|
|
|
|
|
| 116 |
"""
|
| 117 |
|
| 118 |
+
# **FIXED: Gradio 6.0 - css in launch()**
|
| 119 |
+
with gr.Blocks() as demo:
|
| 120 |
# HEADER
|
| 121 |
with gr.Column(elem_classes="center-content"):
|
| 122 |
gr.Markdown(
|
|
|
|
| 124 |
elem_classes="header-gradient glass-card"
|
| 125 |
)
|
| 126 |
|
| 127 |
+
# TABS
|
| 128 |
with gr.Tabs(elem_classes="center-content"):
|
| 129 |
for proj in projects:
|
| 130 |
with gr.TabItem(proj["name"]):
|
| 131 |
with gr.Column(elem_classes="glass-card center-content"):
|
| 132 |
+
gr.Markdown(f"# 🚀 **{proj['name']}**")
|
| 133 |
+
gr.Markdown(f"**📝 {proj['desc']}**")
|
| 134 |
+
gr.Markdown(f"**🛠️ Tech Stack:** {' • '.join(proj['skills'])}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
|
|
|
| 136 |
gr.HTML(f'''
|
| 137 |
+
<div style="width:100%; text-align:center;">
|
| 138 |
+
<a href="{proj['live']}" target="_blank" class="demo-btn" style="text-decoration:none;">
|
| 139 |
🎮 Launch {proj['name']} Live Demo
|
| 140 |
</a>
|
| 141 |
<div class="video-container">
|
| 142 |
<video controls preload="metadata"
|
| 143 |
+
style="width:100%; height:auto; max-height:350px; border-radius:16px; margin-top:1rem; box-shadow:0 20px 40px rgba(0,0,0,0.4);">
|
| 144 |
<source src="{proj['video']}" type="video/mp4">
|
|
|
|
| 145 |
</video>
|
| 146 |
</div>
|
| 147 |
</div>
|
| 148 |
''')
|
| 149 |
|
| 150 |
+
# **FIXED: css + height in launch()**
|
| 151 |
+
demo.launch(
|
| 152 |
+
share=True,
|
| 153 |
+
debug=True,
|
| 154 |
+
show_error=True,
|
| 155 |
+
css=css,
|
| 156 |
+
height=1000
|
| 157 |
+
)
|