Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,59 +10,33 @@ 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(
|
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 |
-
#
|
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 |
-
|
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 |
-
#
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
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 |
-
#
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
demo.launch()
|
|
|
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")) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
gr.Markdown("# 𧬠GENESIS-AI β Synthetic Biology Research Engine")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
|
|
17 |
with gr.Row():
|
18 |
+
query_box = gr.Textbox(label="Enter Your Research Topic", scale=4)
|
|
|
|
|
|
|
|
|
19 |
run_btn = gr.Button("π Run Research", variant="primary", scale=1)
|
20 |
|
21 |
+
gr.Markdown("**Or try one of these demo queries:**")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
# Outputs (must be defined before using in button.click)
|
24 |
+
summary_out = gr.Textbox(label="Executive Summary", lines=15, interactive=False)
|
25 |
+
cites_out = gr.Markdown()
|
26 |
+
img_out = gr.Image(type="filepath", label="Generated Research Diagram")
|
27 |
+
audio_out = gr.Audio(type="filepath", label="AI Narration")
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
# Create clickable buttons for demo queries
|
30 |
+
with gr.Row():
|
31 |
+
for q in DEMO_QUERIES:
|
32 |
+
btn = gr.Button(q)
|
33 |
+
btn.click(fn=run_pipeline_ui,
|
34 |
+
inputs=gr.Textbox(value=q, visible=False),
|
35 |
+
outputs=[summary_out, cites_out, img_out, audio_out])
|
36 |
+
|
37 |
+
# Main run button
|
38 |
+
run_btn.click(fn=run_pipeline_ui,
|
39 |
+
inputs=query_box,
|
40 |
+
outputs=[summary_out, cites_out, img_out, audio_out])
|
41 |
|
42 |
demo.launch()
|