Spaces:
Sleeping
Sleeping
# 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() | |