Spaces:
Sleeping
Sleeping
from __future__ import annotations | |
import os, asyncio, json | |
import gradio as gr | |
from dotenv import load_dotenv | |
load_dotenv() | |
from genesis.pipeline import research_once | |
APP_TITLE = "GENESIS-AI β Synthetic Biology Deep Research (Safety-First)" | |
APP_DESC = "High-level synthetic biology literature synthesis with citations. This app **never** produces operational protocols." | |
async def run_research(query: str, fast: bool): | |
out = await research_once(query, fast=fast) | |
final_text = out.get("final_output") or "_No output_" | |
cites = out.get("citations", []) | |
cites_md = "\n".join([f"- [{c.get('title','link')}]({c.get('url','')})" for c in cites]) or "_None detected_" | |
return final_text, cites_md, json.dumps(out, indent=2) | |
with gr.Blocks(theme=gr.themes.Soft(), fill_height=True) as demo: | |
gr.Markdown(f"# {APP_TITLE}") | |
gr.Markdown(APP_DESC) | |
query = gr.Textbox(label="Your high-level research request", lines=4, placeholder="e.g., High-level synthesis of CRISPR base-editing trends in oncology (last 2 years).") | |
fast = gr.Checkbox(label="Fast mode (o4-mini-deep-research)", value=False) | |
go = gr.Button("Run Deep Research", variant="primary") | |
with gr.Tabs(): | |
with gr.Tab("Research Report"): | |
report = gr.Markdown() | |
with gr.Tab("Citations"): | |
citations = gr.Markdown() | |
with gr.Tab("JSON Export"): | |
json_out = gr.Code(language="json") | |
go.click(fn=run_research, inputs=[query, fast], outputs=[report, citations, json_out]) | |
if __name__ == "__main__": | |
demo.launch() | |