Spaces:
Sleeping
Sleeping
File size: 2,157 Bytes
f103ad7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | """
BioMCP Gradio App — Main entry point.
Assembles all tabs into one cohesive application.
"""
import gradio as gr
from core.config import load_env_keys
from tabs.settings import create_settings_tab
from tabs.discover import create_discover_tab
from tabs.search import create_search_tab
from tabs.get_detail import create_get_tab
from tabs.helpers import create_helpers_tab
from tabs.enrichment import create_enrichment_tab
from tabs.batch import create_batch_tab
DESCRIPTION = """
# 🧬 BioMCP Explorer
**One interface. Every biomedical entity. Evidence from the sources you trust.**
Explore genes, variants, articles, trials, drugs, diseases, pathways, proteins, adverse events, PGx, GWAS, and phenotypes
— all powered by [BioMCP](https://biomcp.org/) across 30+ upstream APIs.
> **Tip:** Start with the **⚙️ Settings** tab to configure API keys, then explore any entity tab.
"""
def create_app():
with gr.Blocks(title="BioMCP Explorer") as app:
gr.Markdown(DESCRIPTION)
# Session state lives outside tabs so every tab can share it
session_keys = gr.State(load_env_keys())
with gr.Tabs():
# Settings tab first — pass session_keys in
create_settings_tab(session_keys)
# All feature tabs, sharing the same session_keys
create_discover_tab(session_keys)
create_search_tab(session_keys)
create_get_tab(session_keys)
create_helpers_tab(session_keys)
create_enrichment_tab(session_keys)
create_batch_tab(session_keys)
return app
if __name__ == "__main__":
import os
is_hf = os.environ.get("SPACE_ID") is not None
app = create_app()
app.launch(
server_name="0.0.0.0" if is_hf else "127.0.0.1",
server_port=7860 if is_hf else 7865,
share=False,
show_error=True,
theme=gr.themes.Soft(
primary_hue="blue",
secondary_hue="cyan",
neutral_hue="slate",
),
css="""
.gradio-container { max-width: 1400px !important; }
footer { display: none !important; }
""",
)
|