Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -320,20 +320,6 @@ def fetch_local_events():
|
|
320 |
return "<p>Failed to fetch local events</p>"
|
321 |
|
322 |
|
323 |
-
|
324 |
-
# response = requests.get(url)
|
325 |
-
# if response.status_code == 200:
|
326 |
-
# events_results = response.json().get("events_results", [])
|
327 |
-
# events_text = "<h2>Local Events </h2>"
|
328 |
-
# for index, event in enumerate(events_results):
|
329 |
-
# title = event.get("title", "No title")
|
330 |
-
# date = event.get("date", "No date")
|
331 |
-
# location = event.get("address", "No location")
|
332 |
-
# link = event.get("link", "#")
|
333 |
-
# events_text += f"<p>{index + 1}. {title}<br> Date: {date}<br> Location: {location}<br> <a href='{link}' target='_blank'>Link :</a> <br>"
|
334 |
-
# return events_text
|
335 |
-
# else:
|
336 |
-
# return "Failed to fetch local events"
|
337 |
|
338 |
# Function to fetch local weather
|
339 |
def fetch_local_weather():
|
@@ -417,16 +403,6 @@ def get_weather_icon(condition):
|
|
417 |
return condition_map.get(condition, "c01d")
|
418 |
|
419 |
|
420 |
-
|
421 |
-
# weather_html = f"<h2>Local Weather</h2>"
|
422 |
-
# weather_html += f"<p>Temperature: {temp}°C</p>"
|
423 |
-
# weather_html += f"<p>Condition: {condition}</p>"
|
424 |
-
# weather_html += f"<p>Humidity: {humidity}%</p>"
|
425 |
-
|
426 |
-
# return weather_html
|
427 |
-
# except requests.exceptions.RequestException as e:
|
428 |
-
# return f"<p>Failed to fetch local weather: {e}</p>"
|
429 |
-
|
430 |
# Voice Control
|
431 |
import numpy as np
|
432 |
import torch
|
@@ -516,6 +492,141 @@ def generate_audio_elevenlabs(text):
|
|
516 |
|
517 |
# Gradio Blocks interface
|
518 |
with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
with gr.Row():
|
520 |
with gr.Column():
|
521 |
gr.HTML('''
|
@@ -530,7 +641,9 @@ with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
|
530 |
</style>
|
531 |
''')
|
532 |
chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
|
533 |
-
|
|
|
|
|
534 |
with gr.Column():
|
535 |
weather_output = gr.HTML(value=fetch_local_weather())
|
536 |
|
|
|
320 |
return "<p>Failed to fetch local events</p>"
|
321 |
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
|
324 |
# Function to fetch local weather
|
325 |
def fetch_local_weather():
|
|
|
403 |
return condition_map.get(condition, "c01d")
|
404 |
|
405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
# Voice Control
|
407 |
import numpy as np
|
408 |
import torch
|
|
|
492 |
|
493 |
# Gradio Blocks interface
|
494 |
with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
495 |
+
gr.HTML('''
|
496 |
+
<style>
|
497 |
+
body {
|
498 |
+
margin: 0;
|
499 |
+
padding: 0;
|
500 |
+
overflow: hidden;
|
501 |
+
height: 100%;
|
502 |
+
width: 100%;
|
503 |
+
background: #141E30; /* fallback for old browsers */
|
504 |
+
background: -webkit-linear-gradient(to right, #243B55, #141E30); /* Chrome 10-25, Safari 5.1-6 */
|
505 |
+
background: linear-gradient(to right, #243B55, #141E30);
|
506 |
+
}
|
507 |
+
|
508 |
+
#background-wrap {
|
509 |
+
position: fixed;
|
510 |
+
z-index: -1;
|
511 |
+
top: 0;
|
512 |
+
left: 0;
|
513 |
+
bottom: 0;
|
514 |
+
right: 0;
|
515 |
+
overflow: hidden;
|
516 |
+
}
|
517 |
+
|
518 |
+
.x1 {
|
519 |
+
-webkit-animation: floatUp 10s infinite;
|
520 |
+
animation: floatUp 10s infinite;
|
521 |
+
-webkit-transform: translate3d(0, 0, 0);
|
522 |
+
transform: translate3d(0, 0, 0);
|
523 |
+
}
|
524 |
+
|
525 |
+
.x2 {
|
526 |
+
-webkit-animation: floatUp 15s infinite;
|
527 |
+
animation: floatUp 15s infinite;
|
528 |
+
-webkit-transform: translate3d(0, 0, 0);
|
529 |
+
transform: translate3d(0, 0, 0);
|
530 |
+
}
|
531 |
+
|
532 |
+
.x3 {
|
533 |
+
-webkit-animation: floatUp 20s infinite;
|
534 |
+
animation: floatUp 20s infinite;
|
535 |
+
-webkit-transform: translate3d(0, 0, 0);
|
536 |
+
transform: translate3d(0, 0, 0);
|
537 |
+
}
|
538 |
+
|
539 |
+
.x4 {
|
540 |
+
-webkit-animation: floatUp 25s infinite;
|
541 |
+
animation: floatUp 25s infinite;
|
542 |
+
-webkit-transform: translate3d(0, 0, 0);
|
543 |
+
transform: translate3d(0, 0, 0);
|
544 |
+
}
|
545 |
+
|
546 |
+
.x5 {
|
547 |
+
-webkit-animation: floatUp 30s infinite;
|
548 |
+
animation: floatUp 30s infinite;
|
549 |
+
-webkit-transform: translate3d(0, 0, 0);
|
550 |
+
transform: translate3d(0, 0, 0);
|
551 |
+
}
|
552 |
+
|
553 |
+
@-webkit-keyframes floatUp {
|
554 |
+
0% {
|
555 |
+
-webkit-transform: translateY(100%);
|
556 |
+
transform: translateY(100%);
|
557 |
+
}
|
558 |
+
|
559 |
+
100% {
|
560 |
+
-webkit-transform: translateY(-100%);
|
561 |
+
transform: translateY(-100%);
|
562 |
+
}
|
563 |
+
}
|
564 |
+
|
565 |
+
@keyframes floatUp {
|
566 |
+
0% {
|
567 |
+
-webkit-transform: translateY(100%);
|
568 |
+
transform: translateY(100%);
|
569 |
+
}
|
570 |
+
|
571 |
+
100% {
|
572 |
+
-webkit-transform: translateY(-100%);
|
573 |
+
transform: translateY(-100%);
|
574 |
+
}
|
575 |
+
}
|
576 |
+
|
577 |
+
.bubble {
|
578 |
+
position: absolute;
|
579 |
+
bottom: -100px;
|
580 |
+
-webkit-border-radius: 50%;
|
581 |
+
border-radius: 50%;
|
582 |
+
background: rgba(255, 255, 255, 0.15);
|
583 |
+
-webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
|
584 |
+
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
|
585 |
+
}
|
586 |
+
|
587 |
+
.bubble.x1 {
|
588 |
+
left: 10%;
|
589 |
+
width: 40px;
|
590 |
+
height: 40px;
|
591 |
+
background: rgba(255, 255, 255, 0.1);
|
592 |
+
}
|
593 |
+
|
594 |
+
.bubble.x2 {
|
595 |
+
left: 20%;
|
596 |
+
width: 80px;
|
597 |
+
height: 80px;
|
598 |
+
background: rgba(255, 255, 255, 0.2);
|
599 |
+
}
|
600 |
+
|
601 |
+
.bubble.x3 {
|
602 |
+
left: 25%;
|
603 |
+
width: 60px;
|
604 |
+
height: 60px;
|
605 |
+
background: rgba(255, 255, 255, 0.15);
|
606 |
+
}
|
607 |
+
|
608 |
+
.bubble.x4 {
|
609 |
+
left: 40%;
|
610 |
+
width: 50px;
|
611 |
+
height: 50px;
|
612 |
+
background: rgba(255, 255, 255, 0.3);
|
613 |
+
}
|
614 |
+
|
615 |
+
.bubble.x5 {
|
616 |
+
left: 50%;
|
617 |
+
width: 90px;
|
618 |
+
height: 90px;
|
619 |
+
background: rgba(255, 255, 255, 0.1);
|
620 |
+
}
|
621 |
+
</style>
|
622 |
+
<div id="background-wrap">
|
623 |
+
<div class="bubble x1"></div>
|
624 |
+
<div class="bubble x2"></div>
|
625 |
+
<div class="bubble x3"></div>
|
626 |
+
<div class="bubble x4"></div>
|
627 |
+
<div class="bubble x5"></div>
|
628 |
+
</div>
|
629 |
+
''')
|
630 |
with gr.Row():
|
631 |
with gr.Column():
|
632 |
gr.HTML('''
|
|
|
641 |
</style>
|
642 |
''')
|
643 |
chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
|
644 |
+
|
645 |
+
|
646 |
+
|
647 |
with gr.Column():
|
648 |
weather_output = gr.HTML(value=fetch_local_weather())
|
649 |
|