Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
-
# app.py
|
| 2 |
import os
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
|
| 6 |
from genesis.pipeline import (
|
| 7 |
run_literature_review,
|
| 8 |
run_molecule_lookup,
|
|
@@ -13,7 +11,6 @@ from genesis.pipeline import (
|
|
| 13 |
from genesis.visualization import generate_pathway_graph, generate_funding_network
|
| 14 |
from genesis.utils.pdf_export import export_report_to_pdf
|
| 15 |
|
| 16 |
-
|
| 17 |
# Load custom CSS
|
| 18 |
with open("genesis/static/style.css", "r") as f:
|
| 19 |
custom_css = f.read()
|
|
@@ -32,36 +29,61 @@ Explore molecules, pathways, funding, literature, and images — with real-time
|
|
| 32 |
def literature_tab(query):
|
| 33 |
"""Run literature review (PubMed, ChEMBL, BioPortal, UMLS)"""
|
| 34 |
summary, citations = run_literature_review(query)
|
| 35 |
-
pdf_path = export_report_to_pdf(
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
return summary, citations, pdf_path
|
| 38 |
|
|
|
|
| 39 |
def molecule_tab(molecule_name):
|
| 40 |
"""Fetch molecule data from ChEMBL/NCBI & visualize"""
|
| 41 |
mol_data, mol_img = run_molecule_lookup(molecule_name)
|
| 42 |
-
pdf_path =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
return mol_data, mol_img, pdf_path
|
| 44 |
|
|
|
|
| 45 |
def pathway_tab(pathway_name):
|
| 46 |
"""Run pathway analysis & generate graph"""
|
| 47 |
analysis = run_pathway_analysis(pathway_name)
|
| 48 |
graph_fig = generate_pathway_graph(pathway_name)
|
| 49 |
-
pdf_path =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
return analysis, graph_fig, pdf_path
|
| 51 |
|
|
|
|
| 52 |
def funding_tab(keyword):
|
| 53 |
"""Run funding analysis & generate investor graph"""
|
| 54 |
funding_info = run_funding_analysis(keyword)
|
| 55 |
funding_graph = generate_funding_network(keyword)
|
| 56 |
-
pdf_path =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
return funding_info, funding_graph, pdf_path
|
| 58 |
|
|
|
|
| 59 |
def image_tab(image_file):
|
| 60 |
"""Run microscopy/image analysis"""
|
| 61 |
analysis_text = run_image_analysis(image_file)
|
| 62 |
-
pdf_path =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
return analysis_text, pdf_path
|
| 64 |
|
|
|
|
| 65 |
# =========================
|
| 66 |
# GRADIO UI
|
| 67 |
# =========================
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
|
|
|
|
| 4 |
from genesis.pipeline import (
|
| 5 |
run_literature_review,
|
| 6 |
run_molecule_lookup,
|
|
|
|
| 11 |
from genesis.visualization import generate_pathway_graph, generate_funding_network
|
| 12 |
from genesis.utils.pdf_export import export_report_to_pdf
|
| 13 |
|
|
|
|
| 14 |
# Load custom CSS
|
| 15 |
with open("genesis/static/style.css", "r") as f:
|
| 16 |
custom_css = f.read()
|
|
|
|
| 29 |
def literature_tab(query):
|
| 30 |
"""Run literature review (PubMed, ChEMBL, BioPortal, UMLS)"""
|
| 31 |
summary, citations = run_literature_review(query)
|
| 32 |
+
pdf_path = export_report_to_pdf(
|
| 33 |
+
filename="literature_report.pdf",
|
| 34 |
+
title="Literature Review",
|
| 35 |
+
summary=summary,
|
| 36 |
+
citations=citations
|
| 37 |
+
)
|
| 38 |
return summary, citations, pdf_path
|
| 39 |
|
| 40 |
+
|
| 41 |
def molecule_tab(molecule_name):
|
| 42 |
"""Fetch molecule data from ChEMBL/NCBI & visualize"""
|
| 43 |
mol_data, mol_img = run_molecule_lookup(molecule_name)
|
| 44 |
+
pdf_path = export_report_to_pdf(
|
| 45 |
+
filename="molecule_report.pdf",
|
| 46 |
+
title="Molecule Report",
|
| 47 |
+
summary=mol_data
|
| 48 |
+
)
|
| 49 |
return mol_data, mol_img, pdf_path
|
| 50 |
|
| 51 |
+
|
| 52 |
def pathway_tab(pathway_name):
|
| 53 |
"""Run pathway analysis & generate graph"""
|
| 54 |
analysis = run_pathway_analysis(pathway_name)
|
| 55 |
graph_fig = generate_pathway_graph(pathway_name)
|
| 56 |
+
pdf_path = export_report_to_pdf(
|
| 57 |
+
filename="pathway_report.pdf",
|
| 58 |
+
title="Pathway Analysis",
|
| 59 |
+
summary=analysis
|
| 60 |
+
)
|
| 61 |
return analysis, graph_fig, pdf_path
|
| 62 |
|
| 63 |
+
|
| 64 |
def funding_tab(keyword):
|
| 65 |
"""Run funding analysis & generate investor graph"""
|
| 66 |
funding_info = run_funding_analysis(keyword)
|
| 67 |
funding_graph = generate_funding_network(keyword)
|
| 68 |
+
pdf_path = export_report_to_pdf(
|
| 69 |
+
filename="funding_report.pdf",
|
| 70 |
+
title="Funding Analysis",
|
| 71 |
+
summary=funding_info
|
| 72 |
+
)
|
| 73 |
return funding_info, funding_graph, pdf_path
|
| 74 |
|
| 75 |
+
|
| 76 |
def image_tab(image_file):
|
| 77 |
"""Run microscopy/image analysis"""
|
| 78 |
analysis_text = run_image_analysis(image_file)
|
| 79 |
+
pdf_path = export_report_to_pdf(
|
| 80 |
+
filename="image_report.pdf",
|
| 81 |
+
title="Image Analysis",
|
| 82 |
+
summary=analysis_text
|
| 83 |
+
)
|
| 84 |
return analysis_text, pdf_path
|
| 85 |
|
| 86 |
+
|
| 87 |
# =========================
|
| 88 |
# GRADIO UI
|
| 89 |
# =========================
|