Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,47 +1,65 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import base64
|
| 3 |
|
| 4 |
-
# Base64 encoded Indian flag SVG with animation
|
| 5 |
flag_svg = '''
|
| 6 |
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0
|
| 7 |
-
<
|
| 8 |
-
<
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
</g>
|
| 37 |
-
<use xlink:href="#
|
| 38 |
</g>
|
| 39 |
-
<use xlink:href="#
|
|
|
|
| 40 |
</g>
|
| 41 |
-
<use xlink:href="#c" transform="rotate(60)"/>
|
| 42 |
</g>
|
| 43 |
-
<use xlink:href="#d" transform="rotate(120)"/>
|
| 44 |
-
<use xlink:href="#d" transform="rotate(-120)"/>
|
| 45 |
</g>
|
| 46 |
</svg>
|
| 47 |
'''
|
|
@@ -59,10 +77,11 @@ html = f'''
|
|
| 59 |
height: 100vh;
|
| 60 |
margin: 0;
|
| 61 |
background-color: #f0f0f0;
|
|
|
|
| 62 |
}}
|
| 63 |
.flag-container {{
|
| 64 |
-
width:
|
| 65 |
-
height:
|
| 66 |
perspective: 1000px;
|
| 67 |
}}
|
| 68 |
.flag {{
|
|
@@ -72,8 +91,10 @@ html = f'''
|
|
| 72 |
animation: wave 5s ease-in-out infinite;
|
| 73 |
}}
|
| 74 |
@keyframes wave {{
|
| 75 |
-
0%, 100% {{ transform: rotateY(0deg); }}
|
| 76 |
-
|
|
|
|
|
|
|
| 77 |
}}
|
| 78 |
</style>
|
| 79 |
</head>
|
|
@@ -95,7 +116,7 @@ iface = gr.Interface(
|
|
| 95 |
inputs=[],
|
| 96 |
outputs=gr.HTML(),
|
| 97 |
title="Animated Indian Flag",
|
| 98 |
-
description="An animated Indian flag waving in the
|
| 99 |
)
|
| 100 |
|
| 101 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import base64
|
| 3 |
|
| 4 |
+
# Base64 encoded Indian flag SVG with enhanced animation
|
| 5 |
flag_svg = '''
|
| 6 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 900 600" width="900" height="600">
|
| 7 |
+
<defs>
|
| 8 |
+
<clipPath id="flag-clip">
|
| 9 |
+
<path d="M0,0 Q450,40 900,0 Q900,300 900,600 Q450,560 0,600" />
|
| 10 |
+
</clipPath>
|
| 11 |
+
</defs>
|
| 12 |
+
|
| 13 |
+
<!-- Sky background -->
|
| 14 |
+
<rect width="900" height="600" fill="#87CEEB" />
|
| 15 |
+
|
| 16 |
+
<!-- Moving clouds -->
|
| 17 |
+
<g>
|
| 18 |
+
<path d="M-300,100 Q-150,50 0,100 T300,100" fill="#ffffff" opacity="0.7">
|
| 19 |
+
<animateTransform attributeName="transform" type="translate" from="0 0" to="1200 0" dur="60s" repeatCount="indefinite" />
|
| 20 |
+
</path>
|
| 21 |
+
<path d="M-300,200 Q-150,150 0,200 T300,200" fill="#ffffff" opacity="0.5">
|
| 22 |
+
<animateTransform attributeName="transform" type="translate" from="0 0" to="1200 0" dur="45s" repeatCount="indefinite" />
|
| 23 |
+
</path>
|
| 24 |
+
</g>
|
| 25 |
+
|
| 26 |
+
<!-- Flagpole -->
|
| 27 |
+
<rect x="50" y="50" width="20" height="500" fill="#8B4513" />
|
| 28 |
+
<circle cx="60" cy="50" r="15" fill="#FFD700" />
|
| 29 |
+
|
| 30 |
+
<!-- Animated flag -->
|
| 31 |
+
<g transform="translate(70, 50)">
|
| 32 |
+
<g clip-path="url(#flag-clip)">
|
| 33 |
+
<rect width="830" height="200" fill="#FF9933">
|
| 34 |
+
<animate attributeName="y" values="0;10;0" dur="3s" repeatCount="indefinite" />
|
| 35 |
+
</rect>
|
| 36 |
+
<rect y="200" width="830" height="200" fill="#FFFFFF">
|
| 37 |
+
<animate attributeName="y" values="200;210;200" dur="3s" repeatCount="indefinite" />
|
| 38 |
+
</rect>
|
| 39 |
+
<rect y="400" width="830" height="200" fill="#138808">
|
| 40 |
+
<animate attributeName="y" values="400;410;400" dur="3s" repeatCount="indefinite" />
|
| 41 |
+
</rect>
|
| 42 |
+
<g transform="translate(415,300) scale(3.5)">
|
| 43 |
+
<circle r="20" fill="#000080" />
|
| 44 |
+
<circle r="17.5" fill="#FFFFFF" />
|
| 45 |
+
<circle r="3.5" fill="#000080" />
|
| 46 |
+
<g id="d">
|
| 47 |
+
<g id="c">
|
| 48 |
+
<g id="b">
|
| 49 |
+
<g id="a">
|
| 50 |
+
<circle r="0.875" fill="#000080" transform="rotate(7.5) translate(17.5)" />
|
| 51 |
+
<path fill="#000080" d="M 0,17.5 0.6,7 C 0.6,7 0,2 0,2 0,2 -0.6,7 -0.6,7 L 0,17.5 z" />
|
| 52 |
+
</g>
|
| 53 |
+
<use xlink:href="#a" transform="rotate(15)"/>
|
| 54 |
+
</g>
|
| 55 |
+
<use xlink:href="#b" transform="rotate(30)"/>
|
| 56 |
</g>
|
| 57 |
+
<use xlink:href="#c" transform="rotate(60)"/>
|
| 58 |
</g>
|
| 59 |
+
<use xlink:href="#d" transform="rotate(120)"/>
|
| 60 |
+
<use xlink:href="#d" transform="rotate(-120)"/>
|
| 61 |
</g>
|
|
|
|
| 62 |
</g>
|
|
|
|
|
|
|
| 63 |
</g>
|
| 64 |
</svg>
|
| 65 |
'''
|
|
|
|
| 77 |
height: 100vh;
|
| 78 |
margin: 0;
|
| 79 |
background-color: #f0f0f0;
|
| 80 |
+
overflow: hidden;
|
| 81 |
}}
|
| 82 |
.flag-container {{
|
| 83 |
+
width: 900px;
|
| 84 |
+
height: 600px;
|
| 85 |
perspective: 1000px;
|
| 86 |
}}
|
| 87 |
.flag {{
|
|
|
|
| 91 |
animation: wave 5s ease-in-out infinite;
|
| 92 |
}}
|
| 93 |
@keyframes wave {{
|
| 94 |
+
0%, 100% {{ transform: rotateY(0deg) rotateX(0deg); }}
|
| 95 |
+
25% {{ transform: rotateY(5deg) rotateX(2deg); }}
|
| 96 |
+
50% {{ transform: rotateY(0deg) rotateX(0deg); }}
|
| 97 |
+
75% {{ transform: rotateY(-5deg) rotateX(-2deg); }}
|
| 98 |
}}
|
| 99 |
</style>
|
| 100 |
</head>
|
|
|
|
| 116 |
inputs=[],
|
| 117 |
outputs=gr.HTML(),
|
| 118 |
title="Animated Indian Flag",
|
| 119 |
+
description="An enhanced animated Indian flag waving in the sky."
|
| 120 |
)
|
| 121 |
|
| 122 |
if __name__ == "__main__":
|