|
import gradio as gr |
|
from geminisearch import webSearch |
|
|
|
|
|
mcp_examples = [ |
|
"What are the latest AI technology developments?", |
|
"What's happening in global news today?", |
|
"What's the current cryptocurrency market status?" |
|
] |
|
|
|
|
|
custom_css = """ |
|
.gradio-container { |
|
max-width: 1200px !important; |
|
margin: auto !important; |
|
} |
|
|
|
.chatbot { |
|
border-radius: 15px !important; |
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important; |
|
} |
|
|
|
.input-container { |
|
border-radius: 25px !important; |
|
border: 2px solid #e1e5e9 !important; |
|
} |
|
|
|
.input-container:focus-within { |
|
border-color: #4285f4 !important; |
|
box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1) !important; |
|
} |
|
|
|
h1 { |
|
text-align: center !important; |
|
color: #1a73e8 !important; |
|
font-weight: 600 !important; |
|
margin-bottom: 2rem !important; |
|
} |
|
|
|
.examples { |
|
margin-top: 1rem !important; |
|
} |
|
|
|
.example { |
|
border-radius: 20px !important; |
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; |
|
color: white !important; |
|
border: none !important; |
|
transition: all 0.3s ease !important; |
|
} |
|
|
|
.example:hover { |
|
transform: translateY(-2px) !important; |
|
box-shadow: 0 8px 25px rgba(0,0,0,0.2) !important; |
|
} |
|
""" |
|
|
|
|
|
app = gr.ChatInterface( |
|
webSearch, |
|
chatbot=gr.Chatbot( |
|
height=500, |
|
show_label=False, |
|
container=True, |
|
bubble_full_width=False, |
|
render_markdown=True |
|
), |
|
type="messages", |
|
textbox=gr.Textbox( |
|
placeholder="🔍 Ask me anything about current events, news, or real-time information...", |
|
container=False, |
|
scale=7, |
|
show_label=False, |
|
lines=1, |
|
max_lines=3 |
|
), |
|
title="✨ Quasar LLM Web Chat", |
|
description="Quasar LLM powered interface for real-time web search and intelligent responses.", |
|
theme=gr.themes.Soft( |
|
primary_hue="blue", |
|
secondary_hue="slate", |
|
neutral_hue="slate", |
|
font=gr.themes.GoogleFont("Inter") |
|
), |
|
examples=mcp_examples, |
|
cache_examples=False, |
|
css=custom_css, |
|
analytics_enabled=False, |
|
show_progress="minimal" |
|
) |
|
|
|
|
|
app.queue( |
|
default_concurrency_limit=20, |
|
max_size=50 |
|
) |
|
|
|
if __name__ == "__main__": |
|
app.launch( |
|
mcp_server=True, |
|
share=False, |
|
inbrowser=True, |
|
show_error=True, |
|
quiet=False, |
|
favicon_path=None, |
|
ssl_verify=False |
|
) |