Spaces:
Running
Running
Update PolyAgent/gradio_interface.py
Browse files- PolyAgent/gradio_interface.py +34 -30
PolyAgent/gradio_interface.py
CHANGED
|
@@ -84,41 +84,45 @@ DEFAULT_TARGET_BY_PROPERTY = {
|
|
| 84 |
# Run instructions bubble
|
| 85 |
# -----------------------------------------------------------------------------
|
| 86 |
RUN_INSTRUCTIONS_MD = (
|
| 87 |
-
"### How to
|
| 88 |
"\n"
|
| 89 |
-
"**
|
| 90 |
-
"-
|
| 91 |
-
"-
|
| 92 |
-
"
|
| 93 |
-
" - If you want PNG visuals and RDKit validation: install RDKit (recommended via conda-forge).\n"
|
| 94 |
"\n"
|
| 95 |
-
"
|
| 96 |
-
"
|
| 97 |
-
"
|
| 98 |
-
"
|
| 99 |
-
"
|
| 100 |
-
"
|
|
|
|
| 101 |
"\n"
|
| 102 |
-
"**
|
| 103 |
-
"- `
|
| 104 |
-
"
|
| 105 |
-
"
|
| 106 |
-
" -
|
| 107 |
-
" -
|
|
|
|
| 108 |
"\n"
|
| 109 |
-
"
|
| 110 |
-
"
|
| 111 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
"\n"
|
| 113 |
-
"
|
| 114 |
-
"- To trigger inverse design: include a generation intent (e.g., “generate”, “inverse design”) and a target value.\n"
|
| 115 |
-
"- You can specify `target_value` in text (examples): `target_value=60`, `target: 60`, `Tg 60`.\n"
|
| 116 |
-
"- To seed with a polymer, include a pSMILES in a code block or via `seed_psmiles:`.\n"
|
| 117 |
-
"- To control citation count: ask explicitly (e.g., “cite 10 papers”).\n"
|
| 118 |
"\n"
|
| 119 |
-
"
|
| 120 |
-
"
|
| 121 |
-
"
|
|
|
|
| 122 |
)
|
| 123 |
|
| 124 |
def pretty_json(x: Any) -> str:
|
|
@@ -1261,7 +1265,7 @@ def build_ui() -> gr.Blocks:
|
|
| 1261 |
) as demo:
|
| 1262 |
state = gr.State({})
|
| 1263 |
|
| 1264 |
-
gr.Markdown("## PolyAgent
|
| 1265 |
|
| 1266 |
# Big bubble shown on load and retained (no dismiss / no state gating).
|
| 1267 |
gr.Markdown(RUN_INSTRUCTIONS_MD, elem_classes=["info-bubble"])
|
|
|
|
| 84 |
# Run instructions bubble
|
| 85 |
# -----------------------------------------------------------------------------
|
| 86 |
RUN_INSTRUCTIONS_MD = (
|
| 87 |
+
"### How to use PolyAgent\n"
|
| 88 |
"\n"
|
| 89 |
+
"PolyAgent is a web app with three **Tabs** at the top:\n"
|
| 90 |
+
"- **PolyAgent Console** (main workflow)\n"
|
| 91 |
+
"- **Tools** (run individual tools)\n"
|
| 92 |
+
"- **Other LLMs** (baseline LLM-only answers)\n"
|
|
|
|
| 93 |
"\n"
|
| 94 |
+
"#### PolyAgent Console\n"
|
| 95 |
+
"Use this Tab for the full, end-to-end run.\n"
|
| 96 |
+
"1) In **Questions**, paste your request (one question or multiple).\n"
|
| 97 |
+
"2) Click **Run PolyAgent**.\n"
|
| 98 |
+
"3) Read the results in:\n"
|
| 99 |
+
" - **PolyAgent Answer**: the final structured response.\n"
|
| 100 |
+
" - **PNG Artifacts**: any available visuals (molecule render, generation grid, explainability heatmap).\n"
|
| 101 |
"\n"
|
| 102 |
+
"**Prompt tips (what PolyAgent detects automatically):**\n"
|
| 103 |
+
"- **Inverse design / generation**: include words like `generate` or `inverse design` **and** include a numeric target\n"
|
| 104 |
+
" (examples: `target_value=60`, `target: 60`, `Tg 60`).\n"
|
| 105 |
+
"- **Seed polymer**: provide a pSMILES either:\n"
|
| 106 |
+
" - inside a fenced code block, or\n"
|
| 107 |
+
" - with a keyed prefix like `seed_psmiles:`.\n"
|
| 108 |
+
"- **Citations**: if you want a specific count, say it explicitly (example: `cite 10 papers`).\n"
|
| 109 |
"\n"
|
| 110 |
+
"#### Tools (debugging / run one step at a time)\n"
|
| 111 |
+
"Use this Tab when you want to run a single tool and inspect its raw output.\n"
|
| 112 |
+
"Each section is a collapsible **Accordion** with its own inputs and a run button:\n"
|
| 113 |
+
"- **Data Extraction** (parse/canonicalize pSMILES; may also produce PNGs)\n"
|
| 114 |
+
"- **Property Prediction**\n"
|
| 115 |
+
"- **Polymer Generation (inverse design)**\n"
|
| 116 |
+
"- **Web / RAG** (search + retrieval)\n"
|
| 117 |
+
"- **Explainability**\n"
|
| 118 |
+
"- **Diagnostics** (health checks, e.g., OpenAI probe)\n"
|
| 119 |
"\n"
|
| 120 |
+
"Outputs appear as JSON (for tool results) and/or PNGs (for visuals), depending on the tool.\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
"\n"
|
| 122 |
+
"#### Other LLMs (no tools)\n"
|
| 123 |
+
"Use this Tab to get a direct answer from a selected non-GPT model.\n"
|
| 124 |
+
"It does **not** run PolyAgent tools (no property prediction, no generation tools, no retrieval).\n"
|
| 125 |
+
"Pick a model, paste your prompt, and run it.\n"
|
| 126 |
)
|
| 127 |
|
| 128 |
def pretty_json(x: Any) -> str:
|
|
|
|
| 1265 |
) as demo:
|
| 1266 |
state = gr.State({})
|
| 1267 |
|
| 1268 |
+
gr.Markdown("## PolyAgent 🧪\n")
|
| 1269 |
|
| 1270 |
# Big bubble shown on load and retained (no dismiss / no state gating).
|
| 1271 |
gr.Markdown(RUN_INSTRUCTIONS_MD, elem_classes=["info-bubble"])
|