Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,116 @@
|
|
1 |
import gradio as gr
|
2 |
from geminisearch import webSearch
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
if __name__ == "__main__":
|
15 |
-
app.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from geminisearch import webSearch
|
3 |
|
4 |
+
# Enhanced example questions covering diverse, useful topics
|
5 |
+
enhanced_examples = [
|
6 |
+
"What are the latest developments in AI technology this week?",
|
7 |
+
"What's happening in the stock market today?",
|
8 |
+
"Tell me about recent scientific breakthroughs in 2025",
|
9 |
+
"What are the current global news headlines?",
|
10 |
+
"What's the latest in space exploration and NASA missions?",
|
11 |
+
"What are today's trending topics on social media?",
|
12 |
+
"Give me updates on climate change and environmental news",
|
13 |
+
"What are the newest movie releases and reviews?",
|
14 |
+
"What's the current situation with cryptocurrency markets?",
|
15 |
+
"Tell me about recent tech company announcements",
|
16 |
+
"What are the latest sports scores and news?",
|
17 |
+
"What's new in electric vehicles and sustainable technology?"
|
18 |
+
]
|
19 |
+
|
20 |
+
# Custom CSS for better styling
|
21 |
+
custom_css = """
|
22 |
+
.gradio-container {
|
23 |
+
max-width: 1200px !important;
|
24 |
+
margin: auto !important;
|
25 |
+
}
|
26 |
+
|
27 |
+
.chatbot {
|
28 |
+
border-radius: 15px !important;
|
29 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
|
30 |
+
}
|
31 |
+
|
32 |
+
.input-container {
|
33 |
+
border-radius: 25px !important;
|
34 |
+
border: 2px solid #e1e5e9 !important;
|
35 |
+
}
|
36 |
+
|
37 |
+
.input-container:focus-within {
|
38 |
+
border-color: #4285f4 !important;
|
39 |
+
box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1) !important;
|
40 |
+
}
|
41 |
+
|
42 |
+
h1 {
|
43 |
+
text-align: center !important;
|
44 |
+
color: #1a73e8 !important;
|
45 |
+
font-weight: 600 !important;
|
46 |
+
margin-bottom: 2rem !important;
|
47 |
+
}
|
48 |
+
|
49 |
+
.examples {
|
50 |
+
margin-top: 1rem !important;
|
51 |
+
}
|
52 |
+
|
53 |
+
.example {
|
54 |
+
border-radius: 20px !important;
|
55 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
56 |
+
color: white !important;
|
57 |
+
border: none !important;
|
58 |
+
transition: all 0.3s ease !important;
|
59 |
+
}
|
60 |
+
|
61 |
+
.example:hover {
|
62 |
+
transform: translateY(-2px) !important;
|
63 |
+
box-shadow: 0 8px 25px rgba(0,0,0,0.2) !important;
|
64 |
+
}
|
65 |
+
"""
|
66 |
+
|
67 |
+
# Create the enhanced interface
|
68 |
+
app = gr.ChatInterface(
|
69 |
+
webSearch,
|
70 |
+
chatbot=gr.Chatbot(
|
71 |
+
height=500,
|
72 |
+
show_label=False,
|
73 |
+
container=True,
|
74 |
+
bubble_full_width=False,
|
75 |
+
render_markdown=True
|
76 |
+
),
|
77 |
+
type="messages",
|
78 |
+
textbox=gr.Textbox(
|
79 |
+
placeholder="🔍 Ask me anything about current events, news, or real-time information...",
|
80 |
+
container=False,
|
81 |
+
scale=7,
|
82 |
+
show_label=False,
|
83 |
+
lines=1,
|
84 |
+
max_lines=3
|
85 |
+
),
|
86 |
+
title="🌐 Gemini Web Search Chat",
|
87 |
+
description="Get real-time information and answers from the web. Ask about current events, latest news, market updates, and more!",
|
88 |
+
theme=gr.themes.Soft(
|
89 |
+
primary_hue="blue",
|
90 |
+
secondary_hue="slate",
|
91 |
+
neutral_hue="slate",
|
92 |
+
font=gr.themes.GoogleFont("Inter")
|
93 |
+
),
|
94 |
+
examples=enhanced_examples,
|
95 |
+
cache_examples=False,
|
96 |
+
css=custom_css,
|
97 |
+
analytics_enabled=False,
|
98 |
+
show_progress="minimal"
|
99 |
+
)
|
100 |
+
|
101 |
+
# Additional configuration
|
102 |
+
app.queue(
|
103 |
+
default_concurrency_limit=20,
|
104 |
+
max_size=50
|
105 |
+
)
|
106 |
|
107 |
if __name__ == "__main__":
|
108 |
+
app.launch(
|
109 |
+
mcp_server=True,
|
110 |
+
share=False,
|
111 |
+
inbrowser=True,
|
112 |
+
show_error=True,
|
113 |
+
quiet=False,
|
114 |
+
favicon_path=None,
|
115 |
+
ssl_verify=False
|
116 |
+
)
|