File size: 3,808 Bytes
48c2479
 
 
 
7716bcb
48c2479
 
 
 
7716bcb
48c2479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7716bcb
 
48c2479
 
 
 
 
 
7716bcb
48c2479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7716bcb
48c2479
 
 
 
 
7716bcb
48c2479
 
 
 
 
 
 
 
7716bcb
48c2479
 
 
 
 
7716bcb
48c2479
 
 
 
 
 
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import gradio as gr
import random
from datetime import datetime
from genesis.pipeline import research_once

# --- Color scheme ---
PRIMARY_COLOR = "#00ff88"  # Biotech green
SECONDARY_COLOR = "#ff8800"  # Biotech orange
BG_COLOR = "#0b0f0c"  # Dark lab background

# --- Demo queries ---
DEMO_QUERIES = {
    "Literature & Regulatory Analysis": [
        "CRISPR living therapeutics in clinical trials since 2020",
        "AI-designed enzymes for plastic degradation β€” literature + pathways",
    ],
    "Molecule / Gene Explorer": [
        "BRCA1 structure and docking predictions",
        "Spike protein mutations in SARS-CoV-2 β€” molecular modeling"
    ],
    "Pathway Mapping": [
        "Metabolic pathway for artemisinin biosynthesis in yeast",
        "Synthetic biology pathway for PHB bioplastic production"
    ],
    "Funding Network": [
        "Synthetic biology startups in oncology β€” funding map",
        "Venture capital in microbial biofactories since 2018"
    ],
    "Microscopy & Image Analysis": [
        "Analyze fluorescence microscopy for cancer cell segmentation",
        "Detect bacterial morphology in electron microscopy images"
    ]
}

# --- Function to run queries ---
def run_query(query):
    if not query.strip():
        return "Please enter a query.", None, None
    result = research_once(query)
    return result["summary"], result.get("visual_image_url"), result.get("audio_url")

# --- Custom CSS for neon biotech theme ---
custom_css = f"""
body {{
    background-color: {BG_COLOR};
}}
.gradio-container {{
    background: {BG_COLOR} !important;
    color: white !important;
}}
button {{
    border-radius: 12px !important;
    border: 2px solid {PRIMARY_COLOR} !important;
    background-color: transparent !important;
    color: {PRIMARY_COLOR} !important;
    transition: 0.3s;
}}
button:hover {{
    background-color: {PRIMARY_COLOR} !important;
    color: black !important;
    box-shadow: 0px 0px 15px {PRIMARY_COLOR};
}}
.particle-bg {{
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at center, {PRIMARY_COLOR}11, {BG_COLOR} 80%);
}}
.demo-chip {{
    display: inline-block;
    padding: 8px 14px;
    margin: 4px;
    border-radius: 20px;
    border: 1px solid {SECONDARY_COLOR};
    color: {SECONDARY_COLOR};
    cursor: pointer;
    transition: 0.3s;
}}
.demo-chip:hover {{
    background-color: {SECONDARY_COLOR};
    color: black;
    box-shadow: 0px 0px 10px {SECONDARY_COLOR};
}}
"""

# --- Build UI ---
with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
    gr.HTML(f"<div class='particle-bg'></div>")
    gr.HTML(f"<h1 style='color:{PRIMARY_COLOR};text-align:center'>🧬 GENESIS-AI</h1>")
    gr.HTML(f"<h3 style='color:{SECONDARY_COLOR};text-align:center'>The Synthetic Biology Brain</h3>")

    with gr.Tabs():
        for mode, queries in DEMO_QUERIES.items():
            with gr.Tab(mode):
                query_box = gr.Textbox(label=f"Enter your query for {mode}", placeholder="Type here...")
                run_btn = gr.Button(f"Run {mode}")
                result_text = gr.Textbox(label="Summary", lines=8)
                result_image = gr.Image(label="Generated Diagram / Analysis", type="filepath")
                result_audio = gr.Audio(label="Narrated Summary", type="filepath")

                # Demo query chips
                with gr.Row():
                    for q in queries:
                        btn = gr.Button(q)
                        btn.click(fn=lambda x=q: (x,), outputs=query_box)

                # Link run button
                run_btn.click(fn=run_query, inputs=query_box, outputs=[result_text, result_image, result_audio])

# Launch
if __name__ == "__main__":
    demo.launch(server_name="0.0.0.0", server_port=7860)