Bhavika67's picture
Upload 64 files
6fa37e3 verified
Raw
History Blame Contribute Delete
1.51 kB
"""
app.py β€” Gradio UI entry point
───────────────────────────────
Architecture:
Gradio UI β†’ FastAPI (port 8000) β†’ MCP Server β†’ SQLite
Module layout:
api_client/http.py β€” raw GET / POST / DELETE
api_client/context.py β€” context + namespace API calls
api_client/chat.py β€” chat + stats API calls
components/chat_tab.py β€” Chat tab
components/context_tab.py β€” Context Manager tab
components/namespace_tab.py β€” Namespaces tab
components/stats_tab.py β€” Stats tab
Run:
python src/ui/app.py
"""
import gradio as gr
from components import chat_tab, context_tab, namespace_tab, stats_tab
with gr.Blocks(title="MCP Context Sharing") as app:
gr.Markdown("# MCP Context Sharing System")
gr.Markdown(
"**Architecture:** Gradio UI β†’ FastAPI (port 8000) β†’ MCP Server β†’ SQLite \n"
"**Stack:** OpenAI Β· MCP Β· FastAPI Β· Gradio"
)
with gr.Tabs():
with gr.Tab("Chat"):
chat_tab.build()
with gr.Tab("Context Manager"):
context_tab.build()
with gr.Tab("Namespaces"):
namespace_tab.build(app)
with gr.Tab("Stats"):
stats_tab.build(app)
if __name__ == "__main__":
app.launch(
server_name="0.0.0.0",
server_port=7860,
show_error=True,
theme=gr.themes.Soft(),
)