Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,49 +86,14 @@ body {
|
|
| 86 |
box-shadow: 0 20px 40px rgba(255, 107, 107, 0.4) !important;
|
| 87 |
}
|
| 88 |
|
| 89 |
-
.video-
|
| 90 |
-
|
| 91 |
-
width: 100% !important;
|
| 92 |
-
|
| 93 |
-
height: 350px !important;
|
| 94 |
-
margin: 1.5rem auto !important;
|
| 95 |
border-radius: 16px !important;
|
| 96 |
-
overflow: hidden !important;
|
| 97 |
-
background: #000 !important;
|
| 98 |
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
|
| 99 |
}
|
| 100 |
|
| 101 |
-
.video-container video {
|
| 102 |
-
width: 100% !important;
|
| 103 |
-
height: 100% !important;
|
| 104 |
-
object-fit: cover !important;
|
| 105 |
-
display: block !important;
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
.video-placeholder {
|
| 109 |
-
position: absolute !important;
|
| 110 |
-
top: 0 !important;
|
| 111 |
-
left: 0 !important;
|
| 112 |
-
width: 100% !important;
|
| 113 |
-
height: 100% !important;
|
| 114 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 115 |
-
display: flex !important;
|
| 116 |
-
align-items: center !important;
|
| 117 |
-
justify-content: center !important;
|
| 118 |
-
color: white !important;
|
| 119 |
-
font-size: 3rem !important;
|
| 120 |
-
z-index: 1 !important;
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
.video-loading {
|
| 124 |
-
animation: spin 1s linear infinite !important;
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
@keyframes spin {
|
| 128 |
-
0% { transform: rotate(0deg) !important; }
|
| 129 |
-
100% { transform: rotate(360deg) !important; }
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
.header-gradient {
|
| 133 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 134 |
border-radius: 24px !important;
|
|
@@ -139,10 +104,16 @@ body {
|
|
| 139 |
|
| 140 |
@media (max-width: 768px) {
|
| 141 |
.demo-btn { padding: 1rem 2rem !important; font-size: 1rem !important; }
|
| 142 |
-
.video-
|
| 143 |
}
|
| 144 |
"""
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
with gr.Blocks() as demo:
|
| 147 |
# Background Video
|
| 148 |
gr.HTML("""
|
|
@@ -180,20 +151,18 @@ with gr.Blocks() as demo:
|
|
| 180 |
</a>
|
| 181 |
''')
|
| 182 |
|
| 183 |
-
#
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
</
|
| 195 |
-
</div>
|
| 196 |
-
''')
|
| 197 |
|
| 198 |
demo.launch(
|
| 199 |
share=True,
|
|
|
|
| 86 |
box-shadow: 0 20px 40px rgba(255, 107, 107, 0.4) !important;
|
| 87 |
}
|
| 88 |
|
| 89 |
+
.video-medium {
|
| 90 |
+
height: 350px !important;
|
| 91 |
+
max-width: 100% !important;
|
| 92 |
+
width: 650px !important;
|
|
|
|
|
|
|
| 93 |
border-radius: 16px !important;
|
|
|
|
|
|
|
| 94 |
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
|
| 95 |
}
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
.header-gradient {
|
| 98 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 99 |
border-radius: 24px !important;
|
|
|
|
| 104 |
|
| 105 |
@media (max-width: 768px) {
|
| 106 |
.demo-btn { padding: 1rem 2rem !important; font-size: 1rem !important; }
|
| 107 |
+
.video-medium { height: 280px !important; width: 100% !important; }
|
| 108 |
}
|
| 109 |
"""
|
| 110 |
|
| 111 |
+
def get_video_file(video_path):
|
| 112 |
+
"""Returns the video file if it exists, otherwise returns None"""
|
| 113 |
+
if os.path.exists(video_path):
|
| 114 |
+
return video_path
|
| 115 |
+
return None
|
| 116 |
+
|
| 117 |
with gr.Blocks() as demo:
|
| 118 |
# Background Video
|
| 119 |
gr.HTML("""
|
|
|
|
| 151 |
</a>
|
| 152 |
''')
|
| 153 |
|
| 154 |
+
# Video Component - using Gradio's built-in Video component
|
| 155 |
+
video_file = get_video_file(proj["video"])
|
| 156 |
+
if video_file:
|
| 157 |
+
gr.Video(
|
| 158 |
+
value=video_file,
|
| 159 |
+
label="📹 Project Demo",
|
| 160 |
+
height=350,
|
| 161 |
+
interactive=False,
|
| 162 |
+
elem_classes="video-medium"
|
| 163 |
+
)
|
| 164 |
+
else:
|
| 165 |
+
gr.HTML(f"<div style='padding: 20px; text-align: center; color: #fff;'><p>📹 Video file not found: {proj['video']}</p></div>")
|
|
|
|
|
|
|
| 166 |
|
| 167 |
demo.launch(
|
| 168 |
share=True,
|