mgbam commited on
Commit
7fac952
Β·
verified Β·
1 Parent(s): a75a9dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -19
app.py CHANGED
@@ -1,8 +1,8 @@
1
- # app.py
2
  import gradio as gr
3
  from genesis.pipeline import research_once, DEMO_QUERIES
4
 
5
  def run_pipeline_ui(query):
 
6
  if not query.strip():
7
  return "Please enter a research topic.", "", None, None
8
  report = research_once(query)
@@ -10,45 +10,55 @@ def run_pipeline_ui(query):
10
  citations_md = "\n".join(f"- [{c['type']}]({c['url']})" for c in report["citations"]) or "No citations found."
11
  return summary, citations_md, report["visual_image_url"], report["audio_url"]
12
 
13
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="green", secondary_hue="blue"), css="""
14
- .demo-btn {border-radius: 25px; padding: 8px 14px; font-weight: bold;}
15
- .demo-btn:hover {background-color: #28a745 !important; color: white !important;}
16
- """) as demo:
17
-
 
 
 
 
 
18
  gr.Markdown(
19
  """
20
  # 🧬 GENESIS-AI β€” Synthetic Biology Research Engine
21
- Ask about **CRISPR**, drug design, biosensors, metabolic engineering, and more.
22
  _Your AI co-pilot for disruptive biotech discovery._
23
  """,
24
  elem_id="title"
25
  )
26
-
 
27
  with gr.Row():
28
- 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)
 
 
 
 
29
  run_btn = gr.Button("πŸš€ Run Research", variant="primary", scale=1)
30
-
31
- with gr.Row():
32
- gr.Markdown("**Or try one of these expert-curated demo queries:**")
33
-
34
  with gr.Row():
35
  for q in DEMO_QUERIES:
36
- gr.Button(q, elem_classes="demo-btn").click(
 
37
  fn=run_pipeline_ui,
38
  inputs=gr.Textbox(value=q, visible=False),
39
  outputs=["summary_out", "cites_out", "img_out", "audio_out"]
40
  )
41
 
 
42
  with gr.Tab("πŸ“„ Summary"):
43
- summary_out = gr.Textbox(label="Executive Summary", lines=15, interactive=False)
44
  with gr.Tab("πŸ”— Citations"):
45
- cites_out = gr.Markdown()
46
  with gr.Tab("πŸ–Ό Diagram"):
47
- img_out = gr.Image(type="filepath", label="Generated Research Diagram")
48
  with gr.Tab("πŸ”Š Narration"):
49
- audio_out = gr.Audio(type="filepath", label="AI Narration")
50
 
51
- # Main run button event
52
  run_btn.click(
53
  fn=run_pipeline_ui,
54
  inputs=query_box,
 
 
1
  import gradio as gr
2
  from genesis.pipeline import research_once, DEMO_QUERIES
3
 
4
  def run_pipeline_ui(query):
5
+ """Run the full synthetic biology research pipeline."""
6
  if not query.strip():
7
  return "Please enter a research topic.", "", None, None
8
  report = research_once(query)
 
10
  citations_md = "\n".join(f"- [{c['type']}]({c['url']})" for c in report["citations"]) or "No citations found."
11
  return summary, citations_md, report["visual_image_url"], report["audio_url"]
12
 
13
+ with gr.Blocks(
14
+ theme=gr.themes.Soft(primary_hue="green", secondary_hue="blue"),
15
+ css="""
16
+ #title {text-align: center;}
17
+ .demo-btn {border-radius: 25px; padding: 8px 14px; font-weight: bold;}
18
+ .demo-btn:hover {background-color: #28a745 !important; color: white !important;}
19
+ """
20
+ ) as demo:
21
+
22
+ # Title
23
  gr.Markdown(
24
  """
25
  # 🧬 GENESIS-AI β€” Synthetic Biology Research Engine
 
26
  _Your AI co-pilot for disruptive biotech discovery._
27
  """,
28
  elem_id="title"
29
  )
30
+
31
+ # Input row
32
  with gr.Row():
33
+ query_box = gr.Textbox(
34
+ label="Enter Your Research Topic",
35
+ placeholder="e.g., Design a CRISPR-based living therapeutic for triple-negative breast cancer",
36
+ scale=4
37
+ )
38
  run_btn = gr.Button("πŸš€ Run Research", variant="primary", scale=1)
39
+
40
+ # Demo query buttons
41
+ gr.Markdown("**Or try one of these expert-curated demo queries:**")
 
42
  with gr.Row():
43
  for q in DEMO_QUERIES:
44
+ btn = gr.Button(q, elem_classes="demo-btn")
45
+ btn.click(
46
  fn=run_pipeline_ui,
47
  inputs=gr.Textbox(value=q, visible=False),
48
  outputs=["summary_out", "cites_out", "img_out", "audio_out"]
49
  )
50
 
51
+ # Output tabs
52
  with gr.Tab("πŸ“„ Summary"):
53
+ summary_out = gr.Textbox(label="Executive Summary", lines=15, interactive=False, elem_id="summary_out")
54
  with gr.Tab("πŸ”— Citations"):
55
+ cites_out = gr.Markdown(elem_id="cites_out")
56
  with gr.Tab("πŸ–Ό Diagram"):
57
+ img_out = gr.Image(type="filepath", label="Generated Research Diagram", elem_id="img_out")
58
  with gr.Tab("πŸ”Š Narration"):
59
+ audio_out = gr.Audio(type="filepath", label="AI Narration", elem_id="audio_out")
60
 
61
+ # Main run button action
62
  run_btn.click(
63
  fn=run_pipeline_ui,
64
  inputs=query_box,