File size: 3,589 Bytes
335600f
45f823c
 
335600f
fdfd8f7
45f823c
fdfd8f7
 
 
 
 
45f823c
 
fdfd8f7
6edcaf6
45f823c
 
fdfd8f7
 
68d6a9c
fdfd8f7
45f823c
7fac952
fdfd8f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b781adc
fdfd8f7
 
 
68d6a9c
fdfd8f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6edcaf6
5eb3323
fdfd8f7
 
 
 
 
 
 
 
 
 
 
 
 
45f823c
5eb3323
fdfd8f7
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import gradio as gr
from genesis.pipeline import research_once
from genesis.visualization import generate_pathway_graph, generate_funding_network

# Preloaded killer demo queries
DEMO_QUERIES = [
    "CRISPR living therapeutics in clinical trials since 2020",
    "AI-designed enzymes for plastic degradation β€” literature + pathways",
    "Synthetic biology startups in oncology β€” funding map",
    "Metabolic pathway for artemisinin biosynthesis in yeast",
    "Oncolytic virus engineering β€” biosecurity risk analysis"
]

def run_literature_review(query):
    report = research_once(query)
    return (
        report["summary"],
        report["citations"],
        report["structures"],
        report["visual_image_url"],
        report["audio_url"]
    )

def run_pathway_graph():
    entities = ["CRISPR", "Cas9", "DNA Repair", "Therapeutic Delivery"]
    relationships = [
        {"source": "CRISPR", "target": "Cas9", "type": "guides"},
        {"source": "Cas9", "target": "DNA Repair", "type": "triggers"},
        {"source": "DNA Repair", "target": "Therapeutic Delivery", "type": "enables"}
    ]
    return generate_pathway_graph(entities, relationships)

def run_funding_network():
    companies = [
        {"name": "SynBioCorp", "investors": "Sequoia Capital, Andreessen Horowitz"},
        {"name": "BioTheraX", "investors": "SoftBank, ARCH Venture Partners"}
    ]
    return generate_funding_network(companies)

with gr.Blocks(theme=gr.themes.Soft(primary_hue="emerald", secondary_hue="lime")) as app:
    gr.Markdown("# 🧬 GENESIS-AI β€” Synthetic Biology Command Center")
    gr.Markdown("A next-generation **lab instrument** for literature review, pathway mapping, funding analysis, and biosecurity insights.")

    with gr.Row():
        query_input = gr.Textbox(label="Enter your research query", placeholder="e.g., CRISPR living therapeutics in clinical trials since 2020", lines=2)
        run_button = gr.Button("πŸš€ Run Literature Review", variant="primary")

    gr.Markdown("### πŸ”Ή Or click a demo query:")
    with gr.Row():
        demo_btns = []
        for dq in DEMO_QUERIES:
            btn = gr.Button(dq)
            btn.click(fn=lambda q=dq: run_literature_review(q),
                      inputs=[],
                      outputs=["summary_box", "citations_box", "structures_box", "image_out", "audio_out"])
            demo_btns.append(btn)

    with gr.Tab("πŸ“„ Summary"):
        summary_box = gr.Textbox(label="AI-Generated Summary", lines=15, interactive=False)

    with gr.Tab("πŸ“š Citations"):
        citations_box = gr.JSON(label="Citations")

    with gr.Tab("πŸ§ͺ Structures"):
        structures_box = gr.JSON(label="3D Molecular Structures")

    with gr.Tab("πŸ–Ό Diagram"):
        image_out = gr.Image(label="Generated Diagram")

    with gr.Tab("πŸ”Š Narration"):
        audio_out = gr.Audio(label="Narrated Summary", type="filepath")

    gr.Markdown("## 🧭 Additional Tools")

    with gr.Row():
        pathway_btn = gr.Button("🧬 Generate Pathway Graph")
        pathway_img = gr.Image(label="Pathway Graph")
        pathway_btn.click(fn=run_pathway_graph, inputs=[], outputs=pathway_img)

        funding_btn = gr.Button("πŸ’° Generate Funding Network")
        funding_img = gr.Image(label="Funding Network")
        funding_btn.click(fn=run_funding_network, inputs=[], outputs=funding_img)

    # Link main run button
    run_button.click(
        fn=run_literature_review,
        inputs=query_input,
        outputs=[summary_box, citations_box, structures_box, image_out, audio_out]
    )

app.launch()