mgbam commited on
Commit
48c2479
Β·
verified Β·
1 Parent(s): c174942

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +104 -55
app.py CHANGED
@@ -1,64 +1,113 @@
1
- :root {
2
- --green: #00ff9d;
3
- --orange: #ff9900;
4
- --bg-dark: #0a0a0a;
5
- }
6
 
7
- body, html {
8
- margin: 0;
9
- padding: 0;
10
- overflow: hidden;
11
- background-color: var(--bg-dark);
12
- font-family: 'Orbitron', sans-serif;
13
- }
14
 
15
- .fullscreen-bg {
16
- position: relative;
17
- width: 100vw;
18
- height: 100vh;
19
- background: radial-gradient(circle at center, #001a12, #000000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
- #molecule-canvas {
23
- position: absolute;
24
- top: 0; left: 0;
25
- width: 100%; height: 100%;
26
- z-index: 0;
27
- }
28
 
29
- .centered {
30
- position: absolute;
31
- top: 50%; left: 50%;
32
- transform: translate(-50%, -50%);
33
- text-align: center;
34
- z-index: 1;
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- .title {
38
- font-size: 3em;
39
- color: var(--green);
40
- text-shadow: 0 0 20px var(--green);
41
- }
42
 
43
- #enter-btn {
44
- padding: 15px 40px;
45
- font-size: 1.5em;
46
- background: var(--green);
47
- color: black;
48
- border: none;
49
- cursor: pointer;
50
- border-radius: 8px;
51
- box-shadow: 0 0 20px var(--green);
52
- animation: pulse 1.5s infinite;
53
- }
54
 
55
- #enter-btn:hover {
56
- background: var(--orange);
57
- box-shadow: 0 0 20px var(--orange);
58
- }
 
59
 
60
- @keyframes pulse {
61
- 0% { box-shadow: 0 0 10px var(--green); }
62
- 50% { box-shadow: 0 0 30px var(--green); }
63
- 100% { box-shadow: 0 0 10px var(--green); }
64
- }
 
 
1
+ import gradio as gr
2
+ import random
3
+ from datetime import datetime
4
+ from genesis.pipeline import research_once
 
5
 
6
+ # --- Color scheme ---
7
+ PRIMARY_COLOR = "#00ff88" # Biotech green
8
+ SECONDARY_COLOR = "#ff8800" # Biotech orange
9
+ BG_COLOR = "#0b0f0c" # Dark lab background
 
 
 
10
 
11
+ # --- Demo queries ---
12
+ DEMO_QUERIES = {
13
+ "Literature & Regulatory Analysis": [
14
+ "CRISPR living therapeutics in clinical trials since 2020",
15
+ "AI-designed enzymes for plastic degradation β€” literature + pathways",
16
+ ],
17
+ "Molecule / Gene Explorer": [
18
+ "BRCA1 structure and docking predictions",
19
+ "Spike protein mutations in SARS-CoV-2 β€” molecular modeling"
20
+ ],
21
+ "Pathway Mapping": [
22
+ "Metabolic pathway for artemisinin biosynthesis in yeast",
23
+ "Synthetic biology pathway for PHB bioplastic production"
24
+ ],
25
+ "Funding Network": [
26
+ "Synthetic biology startups in oncology β€” funding map",
27
+ "Venture capital in microbial biofactories since 2018"
28
+ ],
29
+ "Microscopy & Image Analysis": [
30
+ "Analyze fluorescence microscopy for cancer cell segmentation",
31
+ "Detect bacterial morphology in electron microscopy images"
32
+ ]
33
  }
34
 
35
+ # --- Function to run queries ---
36
+ def run_query(query):
37
+ if not query.strip():
38
+ return "Please enter a query.", None, None
39
+ result = research_once(query)
40
+ return result["summary"], result.get("visual_image_url"), result.get("audio_url")
41
 
42
+ # --- Custom CSS for neon biotech theme ---
43
+ custom_css = f"""
44
+ body {{
45
+ background-color: {BG_COLOR};
46
+ }}
47
+ .gradio-container {{
48
+ background: {BG_COLOR} !important;
49
+ color: white !important;
50
+ }}
51
+ button {{
52
+ border-radius: 12px !important;
53
+ border: 2px solid {PRIMARY_COLOR} !important;
54
+ background-color: transparent !important;
55
+ color: {PRIMARY_COLOR} !important;
56
+ transition: 0.3s;
57
+ }}
58
+ button:hover {{
59
+ background-color: {PRIMARY_COLOR} !important;
60
+ color: black !important;
61
+ box-shadow: 0px 0px 15px {PRIMARY_COLOR};
62
+ }}
63
+ .particle-bg {{
64
+ position: fixed;
65
+ width: 100%;
66
+ height: 100%;
67
+ z-index: -1;
68
+ background: radial-gradient(circle at center, {PRIMARY_COLOR}11, {BG_COLOR} 80%);
69
+ }}
70
+ .demo-chip {{
71
+ display: inline-block;
72
+ padding: 8px 14px;
73
+ margin: 4px;
74
+ border-radius: 20px;
75
+ border: 1px solid {SECONDARY_COLOR};
76
+ color: {SECONDARY_COLOR};
77
+ cursor: pointer;
78
+ transition: 0.3s;
79
+ }}
80
+ .demo-chip:hover {{
81
+ background-color: {SECONDARY_COLOR};
82
+ color: black;
83
+ box-shadow: 0px 0px 10px {SECONDARY_COLOR};
84
+ }}
85
+ """
86
 
87
+ # --- Build UI ---
88
+ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
89
+ gr.HTML(f"<div class='particle-bg'></div>")
90
+ gr.HTML(f"<h1 style='color:{PRIMARY_COLOR};text-align:center'>🧬 GENESIS-AI</h1>")
91
+ gr.HTML(f"<h3 style='color:{SECONDARY_COLOR};text-align:center'>The Synthetic Biology Brain</h3>")
92
 
93
+ with gr.Tabs():
94
+ for mode, queries in DEMO_QUERIES.items():
95
+ with gr.Tab(mode):
96
+ query_box = gr.Textbox(label=f"Enter your query for {mode}", placeholder="Type here...")
97
+ run_btn = gr.Button(f"Run {mode}")
98
+ result_text = gr.Textbox(label="Summary", lines=8)
99
+ result_image = gr.Image(label="Generated Diagram / Analysis", type="filepath")
100
+ result_audio = gr.Audio(label="Narrated Summary", type="filepath")
 
 
 
101
 
102
+ # Demo query chips
103
+ with gr.Row():
104
+ for q in queries:
105
+ btn = gr.Button(q)
106
+ btn.click(fn=lambda x=q: (x,), outputs=query_box)
107
 
108
+ # Link run button
109
+ run_btn.click(fn=run_query, inputs=query_box, outputs=[result_text, result_image, result_audio])
110
+
111
+ # Launch
112
+ if __name__ == "__main__":
113
+ demo.launch(server_name="0.0.0.0", server_port=7860)