DreamStream-1 commited on
Commit
0536925
Β·
verified Β·
1 Parent(s): 1400dff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -35
app.py CHANGED
@@ -14,7 +14,6 @@ import folium
14
  import torch
15
  import pandas as pd
16
  from sklearn.preprocessing import LabelEncoder
17
- from sklearn.model_selection import train_test_split
18
  from sklearn.tree import DecisionTreeClassifier
19
  from sklearn.ensemble import RandomForestClassifier
20
  from sklearn.naive_bayes import GaussianNB
@@ -255,45 +254,57 @@ def predict_disease(symptoms):
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 the Well-Being Companion!';
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
- createGradioAnimation(); // Automatically create the animation upon load
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  """
291
 
292
- # Gradio Application Interface with JS Animation
293
- with gr.Blocks(js=js) as app:
294
- gr.HTML("<h1 id='welcome-title'>🌟 Well-Being Companion</h1>") # Title for the app
295
 
296
  with gr.Tab("Well-Being Chatbot"):
 
 
 
 
 
 
 
 
 
 
 
297
  with gr.Row():
298
  user_input = gr.Textbox(label="Please Enter Your Message Here", placeholder="Type your message here...", max_lines=3)
299
  location = gr.Textbox(label="Please Enter Your Current Location", placeholder="E.g., Honolulu", max_lines=1)
 
14
  import torch
15
  import pandas as pd
16
  from sklearn.preprocessing import LabelEncoder
 
17
  from sklearn.tree import DecisionTreeClassifier
18
  from sklearn.ensemble import RandomForestClassifier
19
  from sklearn.naive_bayes import GaussianNB
 
254
 
255
  return "\n".join(markdown_output)
256
 
257
+ # CSS for the animated welcome message and improved styles
258
+ welcome_message = """
259
+ <style>
260
+ @keyframes fadeIn {
261
+ 0% { opacity: 0; }
262
+ 100% { opacity: 1; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  }
264
+ #welcome-message {
265
+ font-size: 2em;
266
+ font-weight: bold;
267
+ text-align: center;
268
+ animation: fadeIn 3s ease-in-out;
269
+ margin-bottom: 20px;
270
+ }
271
+ .info-graphic {
272
+ display: flex;
273
+ justify-content: center;
274
+ align-items: center;
275
+ margin: 20px 0;
276
+ }
277
+ .info-graphic img {
278
+ width: 150px; /* Adjust size as needed */
279
+ height: auto; /* Keep aspect ratio */
280
+ margin: 0 10px; /* Space between images */
281
+ }
282
+ h1 {
283
+ text-align: center; /* Center-align the main title */
284
+ font-size: 3em; /* Increase title size */
285
+ color: #004d40; /* Use your theme's color */
286
+ margin-bottom: 20px; /* Space below the title */
287
+ }
288
+ </style>
289
+ <div id="welcome-message">Welcome to the Well-Being Companion!</div>
290
  """
291
 
292
+ # Gradio Application Interface
293
+ with gr.Blocks(css="calm_seafoam.css", theme=gr.themes.Soft()) as app:
294
+ gr.HTML(welcome_message) # Animated welcome message
295
 
296
  with gr.Tab("Well-Being Chatbot"):
297
+ gr.HTML("<h1>🌟 Well-Being Chatbot 🌟</h1>") # Centered title for the chatbot tab
298
+
299
+ # Infographics with images
300
+ gr.HTML("""
301
+ <div class="info-graphic">
302
+ <img src="https://example.com/image1.png" alt="Wellness Image 1">
303
+ <img src="https://example.com/image2.png" alt="Wellness Image 2">
304
+ <img src="https://example.com/image3.png" alt="Wellness Image 3">
305
+ </div>
306
+ """) # Replace these URLs with your actual image links
307
+
308
  with gr.Row():
309
  user_input = gr.Textbox(label="Please Enter Your Message Here", placeholder="Type your message here...", max_lines=3)
310
  location = gr.Textbox(label="Please Enter Your Current Location", placeholder="E.g., Honolulu", max_lines=1)