Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -255,9 +255,45 @@ def predict_disease(symptoms):
|
|
| 255 |
|
| 256 |
return "\n".join(markdown_output)
|
| 257 |
|
| 258 |
-
#
|
| 259 |
-
|
| 260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
|
| 262 |
with gr.Tab("Well-Being Chatbot"):
|
| 263 |
with gr.Row():
|
|
|
|
| 255 |
|
| 256 |
return "\n".join(markdown_output)
|
| 257 |
|
| 258 |
+
# JavaScript code for the animated welcome message
|
| 259 |
+
js = """
|
| 260 |
+
function createGradioAnimation() {
|
| 261 |
+
var container = document.createElement('div');
|
| 262 |
+
container.id = 'gradio-animation';
|
| 263 |
+
container.style.fontSize = '2em';
|
| 264 |
+
container.style.fontWeight = 'bold';
|
| 265 |
+
container.style.textAlign = 'center';
|
| 266 |
+
container.style.marginBottom = '20px';
|
| 267 |
+
|
| 268 |
+
var text = 'Welcome to Gradio!';
|
| 269 |
+
for (var i = 0; i < text.length; i++) {
|
| 270 |
+
(function(i){
|
| 271 |
+
setTimeout(function(){
|
| 272 |
+
var letter = document.createElement('span');
|
| 273 |
+
letter.style.opacity = '0';
|
| 274 |
+
letter.style.transition = 'opacity 0.5s';
|
| 275 |
+
letter.innerText = text[i];
|
| 276 |
+
|
| 277 |
+
container.appendChild(letter);
|
| 278 |
+
|
| 279 |
+
setTimeout(function() {
|
| 280 |
+
letter.style.opacity = '1';
|
| 281 |
+
}, 50);
|
| 282 |
+
}, i * 250);
|
| 283 |
+
})(i);
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
var gradioContainer = document.querySelector('.gradio-container');
|
| 287 |
+
gradioContainer.insertBefore(container, gradioContainer.firstChild);
|
| 288 |
+
|
| 289 |
+
return 'Animation created';
|
| 290 |
+
}
|
| 291 |
+
"""
|
| 292 |
+
|
| 293 |
+
# Gradio Application Interface with JS Animation
|
| 294 |
+
with gr.Blocks(js=js, analytics_enabled=False) as app:
|
| 295 |
+
gr.HTML("<h1 id='welcome-title'>🌟 Well-Being Companion</h1>")
|
| 296 |
+
createGradioAnimation() # Call the animation function upon load
|
| 297 |
|
| 298 |
with gr.Tab("Well-Being Chatbot"):
|
| 299 |
with gr.Row():
|