Spaces:
Build error
Build error
Update PanelInterface.py
Browse files- PanelInterface.py +29 -0
PanelInterface.py
CHANGED
|
@@ -94,5 +94,34 @@ def build_interface(respondent_agents_dict, processor_llm):
|
|
| 94 |
gr.Markdown(ui_texts["footer_html"])
|
| 95 |
|
| 96 |
logging.info("Interface build complete.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
return demo
|
| 98 |
|
|
|
|
| 94 |
gr.Markdown(ui_texts["footer_html"])
|
| 95 |
|
| 96 |
logging.info("Interface build complete.")
|
| 97 |
+
modal_script = """
|
| 98 |
+
<script>
|
| 99 |
+
function showModal(event, id) {
|
| 100 |
+
event.preventDefault();
|
| 101 |
+
const bios = %s;
|
| 102 |
+
const content = bios[id] || "No bio available.";
|
| 103 |
+
|
| 104 |
+
const modal = document.createElement("div");
|
| 105 |
+
modal.id = "custom-modal";
|
| 106 |
+
modal.style.position = "fixed";
|
| 107 |
+
modal.style.top = "50%%";
|
| 108 |
+
modal.style.left = "50%%";
|
| 109 |
+
modal.style.transform = "translate(-50%%, -50%%)";
|
| 110 |
+
modal.style.background = "white";
|
| 111 |
+
modal.style.padding = "20px";
|
| 112 |
+
modal.style.border = "1px solid #ccc";
|
| 113 |
+
modal.style.zIndex = 1000;
|
| 114 |
+
|
| 115 |
+
modal.innerHTML = `
|
| 116 |
+
<div style='max-height: 400px; overflow-y: auto;'>${content}</div>
|
| 117 |
+
<button onclick="document.body.removeChild(document.getElementById('custom-modal'))">Close</button>
|
| 118 |
+
`;
|
| 119 |
+
|
| 120 |
+
document.body.appendChild(modal);
|
| 121 |
+
}
|
| 122 |
+
</script>
|
| 123 |
+
""" % json.dumps(bios_js_object)
|
| 124 |
+
|
| 125 |
+
demo.append(gr.HTML(modal_script))
|
| 126 |
return demo
|
| 127 |
|