Spaces:
Sleeping
Sleeping
File size: 2,487 Bytes
335600f 6edcaf6 335600f 7ca7dca 7fac952 6edcaf6 971e38a 7fac952 b781adc 6edcaf6 b781adc 7fac952 45a73fa 7fac952 6edcaf6 7fac952 45a73fa b781adc 7fac952 b781adc 6edcaf6 b781adc 7fac952 6edcaf6 7fac952 6edcaf6 7fac952 6edcaf6 7fac952 6edcaf6 7fac952 6edcaf6 7fac952 6edcaf6 b781adc 6edcaf6 e3c954b 335600f 6edcaf6 |
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 |
import gradio as gr
from genesis.pipeline import research_once, DEMO_QUERIES
def run_pipeline_ui(query):
"""Run the full synthetic biology research pipeline."""
if not query.strip():
return "Please enter a research topic.", "", None, None
report = research_once(query)
summary = report["summary"]
citations_md = "\n".join(f"- [{c['type']}]({c['url']})" for c in report["citations"]) or "No citations found."
return summary, citations_md, report["visual_image_url"], report["audio_url"]
with gr.Blocks(
theme=gr.themes.Soft(primary_hue="green", secondary_hue="blue"),
css="""
#title {text-align: center;}
.demo-btn {border-radius: 25px; padding: 8px 14px; font-weight: bold;}
.demo-btn:hover {background-color: #28a745 !important; color: white !important;}
"""
) as demo:
# Title
gr.Markdown(
"""
# 𧬠GENESIS-AI β Synthetic Biology Research Engine
_Your AI co-pilot for disruptive biotech discovery._
""",
elem_id="title"
)
# Input row
with gr.Row():
query_box = gr.Textbox(
label="Enter Your Research Topic",
placeholder="e.g., Design a CRISPR-based living therapeutic for triple-negative breast cancer",
scale=4
)
run_btn = gr.Button("π Run Research", variant="primary", scale=1)
# Demo query buttons
gr.Markdown("**Or try one of these expert-curated demo queries:**")
with gr.Row():
for q in DEMO_QUERIES:
btn = gr.Button(q, elem_classes="demo-btn")
btn.click(
fn=run_pipeline_ui,
inputs=gr.Textbox(value=q, visible=False),
outputs=["summary_out", "cites_out", "img_out", "audio_out"]
)
# Output tabs
with gr.Tab("π Summary"):
summary_out = gr.Textbox(label="Executive Summary", lines=15, interactive=False, elem_id="summary_out")
with gr.Tab("π Citations"):
cites_out = gr.Markdown(elem_id="cites_out")
with gr.Tab("πΌ Diagram"):
img_out = gr.Image(type="filepath", label="Generated Research Diagram", elem_id="img_out")
with gr.Tab("π Narration"):
audio_out = gr.Audio(type="filepath", label="AI Narration", elem_id="audio_out")
# Main run button action
run_btn.click(
fn=run_pipeline_ui,
inputs=query_box,
outputs=[summary_out, cites_out, img_out, audio_out]
)
demo.launch()
|