Spaces:
Sleeping
Sleeping
File size: 2,285 Bytes
7ca7dca 335600f 6edcaf6 335600f 7ca7dca 6edcaf6 971e38a 6edcaf6 b781adc 6edcaf6 b781adc 6edcaf6 45a73fa 6edcaf6 45a73fa b781adc 6edcaf6 b781adc 6edcaf6 b781adc 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 |
# app.py
import gradio as gr
from genesis.pipeline import research_once, DEMO_QUERIES
def run_pipeline_ui(query):
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="""
.demo-btn {border-radius: 25px; padding: 8px 14px; font-weight: bold;}
.demo-btn:hover {background-color: #28a745 !important; color: white !important;}
""") as demo:
gr.Markdown(
"""
# 𧬠GENESIS-AI β Synthetic Biology Research Engine
Ask about **CRISPR**, drug design, biosensors, metabolic engineering, and more.
_Your AI co-pilot for disruptive biotech discovery._
""",
elem_id="title"
)
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)
with gr.Row():
gr.Markdown("**Or try one of these expert-curated demo queries:**")
with gr.Row():
for q in DEMO_QUERIES:
gr.Button(q, elem_classes="demo-btn").click(
fn=run_pipeline_ui,
inputs=gr.Textbox(value=q, visible=False),
outputs=["summary_out", "cites_out", "img_out", "audio_out"]
)
with gr.Tab("π Summary"):
summary_out = gr.Textbox(label="Executive Summary", lines=15, interactive=False)
with gr.Tab("π Citations"):
cites_out = gr.Markdown()
with gr.Tab("πΌ Diagram"):
img_out = gr.Image(type="filepath", label="Generated Research Diagram")
with gr.Tab("π Narration"):
audio_out = gr.Audio(type="filepath", label="AI Narration")
# Main run button event
run_btn.click(
fn=run_pipeline_ui,
inputs=query_box,
outputs=[summary_out, cites_out, img_out, audio_out]
)
demo.launch()
|