Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,100 +97,105 @@ theme_options = [
|
|
| 97 |
|
| 98 |
language_options = ["English", "Urdu"]
|
| 99 |
|
| 100 |
-
#
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
.
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
.
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
# Header
|
| 196 |
gr.HTML("""
|
|
@@ -252,11 +257,11 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
|
|
| 252 |
info="Generate audio narration"
|
| 253 |
)
|
| 254 |
|
|
|
|
|
|
|
| 255 |
generate_btn = gr.Button(
|
| 256 |
-
"✨ Create Magical Story! ✨"
|
| 257 |
-
elem_classes="generate-btn"
|
| 258 |
)
|
| 259 |
-
gr.HTML('</div>')
|
| 260 |
|
| 261 |
# Right Column - Output
|
| 262 |
with gr.Column(scale=2):
|
|
@@ -282,6 +287,24 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
|
|
| 282 |
</div>
|
| 283 |
""")
|
| 284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
generate_btn.click(
|
| 286 |
create_story_interface,
|
| 287 |
inputs=[age_input, theme_input, language_input, tts_input],
|
|
|
|
| 97 |
|
| 98 |
language_options = ["English", "Urdu"]
|
| 99 |
|
| 100 |
+
# Create the interface - WITHOUT css parameter
|
| 101 |
+
with gr.Blocks() as iface:
|
| 102 |
+
|
| 103 |
+
# Inject CSS as HTML
|
| 104 |
+
gr.HTML("""
|
| 105 |
+
<style>
|
| 106 |
+
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap');
|
| 107 |
+
|
| 108 |
+
.gradio-container {
|
| 109 |
+
font-family: 'Comic Neue', cursive !important;
|
| 110 |
+
background: linear-gradient(135deg, #ffafbd, #ffc3a0) !important;
|
| 111 |
+
padding: 20px;
|
| 112 |
+
min-height: 100vh;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.main-header {
|
| 116 |
+
text-align: center;
|
| 117 |
+
font-weight: bold;
|
| 118 |
+
font-size: 3.2em;
|
| 119 |
+
margin: 20px 0;
|
| 120 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
|
| 121 |
+
color: #12979B;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.subtitle {
|
| 125 |
+
text-align: center;
|
| 126 |
+
font-size: 1.5em;
|
| 127 |
+
font-weight: 600;
|
| 128 |
+
color: white;
|
| 129 |
+
margin: 20px 0;
|
| 130 |
+
text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
.control-panel {
|
| 134 |
+
background: #fff5ee;
|
| 135 |
+
border-radius: 15px;
|
| 136 |
+
padding: 20px;
|
| 137 |
+
border: 3px dashed #4ECDC4;
|
| 138 |
+
margin: 20px 0;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.story-container {
|
| 142 |
+
background: #fff5ee;
|
| 143 |
+
border-radius: 20px;
|
| 144 |
+
padding: 25px;
|
| 145 |
+
border: 5px solid #FFD166;
|
| 146 |
+
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
|
| 147 |
+
min-height: 400px;
|
| 148 |
+
margin: 20px 0;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.generate-btn {
|
| 152 |
+
background: linear-gradient(45deg, #FF6B6B, #FF9E7D) !important;
|
| 153 |
+
border: none !important;
|
| 154 |
+
border-radius: 50px !important;
|
| 155 |
+
padding: 15px 30px !important;
|
| 156 |
+
font-size: 1.2em !important;
|
| 157 |
+
font-weight: bold !important;
|
| 158 |
+
color: white !important;
|
| 159 |
+
margin: 20px 0 !important;
|
| 160 |
+
width: 100% !important;
|
| 161 |
+
cursor: pointer !important;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.generate-btn:hover {
|
| 165 |
+
transform: scale(1.05) !important;
|
| 166 |
+
box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4) !important;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.footer {
|
| 170 |
+
text-align: center;
|
| 171 |
+
margin: 20px 0;
|
| 172 |
+
color: #666;
|
| 173 |
+
font-style: italic;
|
| 174 |
+
font-size: 1.1em;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
.warning-box {
|
| 178 |
+
background: #fff3cd;
|
| 179 |
+
border: 2px solid #ffeaa7;
|
| 180 |
+
border-radius: 10px;
|
| 181 |
+
padding: 15px;
|
| 182 |
+
margin: 20px 0;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
/* Style Gradio components */
|
| 186 |
+
.gradio-container .dropdown, .gradio-container .checkbox {
|
| 187 |
+
background: white !important;
|
| 188 |
+
border-radius: 10px !important;
|
| 189 |
+
border: 2px solid #96CEB4 !important;
|
| 190 |
+
margin: 10px 0 !important;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.gradio-container .audio {
|
| 194 |
+
border-radius: 15px !important;
|
| 195 |
+
margin: 20px 0 !important;
|
| 196 |
+
}
|
| 197 |
+
</style>
|
| 198 |
+
""")
|
| 199 |
|
| 200 |
# Header
|
| 201 |
gr.HTML("""
|
|
|
|
| 257 |
info="Generate audio narration"
|
| 258 |
)
|
| 259 |
|
| 260 |
+
gr.HTML('</div>')
|
| 261 |
+
|
| 262 |
generate_btn = gr.Button(
|
| 263 |
+
"✨ Create Magical Story! ✨"
|
|
|
|
| 264 |
)
|
|
|
|
| 265 |
|
| 266 |
# Right Column - Output
|
| 267 |
with gr.Column(scale=2):
|
|
|
|
| 287 |
</div>
|
| 288 |
""")
|
| 289 |
|
| 290 |
+
# Apply button styling with JavaScript
|
| 291 |
+
gr.HTML("""
|
| 292 |
+
<script>
|
| 293 |
+
function styleButton() {
|
| 294 |
+
const buttons = document.querySelectorAll('button');
|
| 295 |
+
buttons.forEach(button => {
|
| 296 |
+
if (button.textContent.includes('Create Magical Story')) {
|
| 297 |
+
button.classList.add('generate-btn');
|
| 298 |
+
}
|
| 299 |
+
});
|
| 300 |
+
}
|
| 301 |
+
// Style button on load and when DOM changes
|
| 302 |
+
document.addEventListener('DOMContentLoaded', styleButton);
|
| 303 |
+
setTimeout(styleButton, 1000);
|
| 304 |
+
setInterval(styleButton, 2000);
|
| 305 |
+
</script>
|
| 306 |
+
""")
|
| 307 |
+
|
| 308 |
generate_btn.click(
|
| 309 |
create_story_interface,
|
| 310 |
inputs=[age_input, theme_input, language_input, tts_input],
|