Spaces:
Build error
Build error
Add in a popup with our policy on what can/can’t be discussed (placeholder text for now to test)
Browse files- PanelInterface.py +70 -2
PanelInterface.py
CHANGED
|
@@ -82,7 +82,8 @@ def build_interface(respondent_agents_dict, processor_llm):
|
|
| 82 |
gr.Markdown("""
|
| 83 |
## Recommended Topics for Discussion
|
| 84 |
- Our agents have been trained exclusively on topics relevant to youth attitudes, behaviours, and lifestyle preferences.
|
| 85 |
-
- To ensure meaningful and respectful conversations, please do not ask inappropriate, offensive, or out-of-scope questions.
|
|
|
|
| 86 |
""")
|
| 87 |
|
| 88 |
gr.HTML(f"""
|
|
@@ -115,8 +116,36 @@ def build_interface(respondent_agents_dict, processor_llm):
|
|
| 115 |
left: 0;
|
| 116 |
width: 100%;
|
| 117 |
height: 100%;
|
| 118 |
-
z-index: 999;
|
| 119 |
' onclick='closeModal()'></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
<script>
|
| 121 |
const bios = {json.dumps(bios_js_object)};
|
| 122 |
|
|
@@ -163,6 +192,45 @@ def build_interface(respondent_agents_dict, processor_llm):
|
|
| 163 |
document.getElementById('bioModal').style.display = 'none';
|
| 164 |
document.getElementById('modalBackdrop').style.display = 'none';
|
| 165 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
</script>
|
| 167 |
""")
|
| 168 |
|
|
|
|
| 82 |
gr.Markdown("""
|
| 83 |
## Recommended Topics for Discussion
|
| 84 |
- Our agents have been trained exclusively on topics relevant to youth attitudes, behaviours, and lifestyle preferences.
|
| 85 |
+
- To ensure meaningful and respectful conversations, please do not ask inappropriate, offensive, or out-of-scope questions.
|
| 86 |
+
- <a href='javascript:void(0);' onclick='showTopicsModal(event)'><b>Click here for a list of permitted and prohibited topics.</b></a>
|
| 87 |
""")
|
| 88 |
|
| 89 |
gr.HTML(f"""
|
|
|
|
| 116 |
left: 0;
|
| 117 |
width: 100%;
|
| 118 |
height: 100%;
|
| 119 |
+
z-index: 999;
|
| 120 |
' onclick='closeModal()'></div>
|
| 121 |
+
|
| 122 |
+
<div id='topicsModal' style='
|
| 123 |
+
display: none;
|
| 124 |
+
position: fixed;
|
| 125 |
+
top: 50%;
|
| 126 |
+
left: 50%;
|
| 127 |
+
transform: translate(-50%, -50%);
|
| 128 |
+
width: 400px;
|
| 129 |
+
max-height: 300px;
|
| 130 |
+
padding: 20px;
|
| 131 |
+
text-align: left;
|
| 132 |
+
z-index: 1000;
|
| 133 |
+
overflow-y: auto;
|
| 134 |
+
border-radius: 10px;
|
| 135 |
+
'>
|
| 136 |
+
<p id='topicsContent'>placeholder</p>
|
| 137 |
+
<button onclick='closeTopicsModal()' id='closeTopicsButton'>Close</button>
|
| 138 |
+
</div>
|
| 139 |
+
<div id='topicsBackdrop' style='
|
| 140 |
+
display: none;
|
| 141 |
+
position: fixed;
|
| 142 |
+
top: 0;
|
| 143 |
+
left: 0;
|
| 144 |
+
width: 100%;
|
| 145 |
+
height: 100%;
|
| 146 |
+
z-index: 999;
|
| 147 |
+
' onclick='closeTopicsModal()'></div>
|
| 148 |
+
|
| 149 |
<script>
|
| 150 |
const bios = {json.dumps(bios_js_object)};
|
| 151 |
|
|
|
|
| 192 |
document.getElementById('bioModal').style.display = 'none';
|
| 193 |
document.getElementById('modalBackdrop').style.display = 'none';
|
| 194 |
}}
|
| 195 |
+
|
| 196 |
+
function showTopicsModal(event) {{
|
| 197 |
+
event.preventDefault();
|
| 198 |
+
const modal = document.getElementById('topicsModal');
|
| 199 |
+
const backdrop = document.getElementById('topicsBackdrop');
|
| 200 |
+
const closeButton = document.getElementById('closeTopicsButton');
|
| 201 |
+
const topicsContent = document.getElementById('topicsContent');
|
| 202 |
+
topicsContent.innerText = 'placeholder';
|
| 203 |
+
modal.style.display = 'block';
|
| 204 |
+
backdrop.style.display = 'block';
|
| 205 |
+
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 206 |
+
if (prefersDark) {{
|
| 207 |
+
modal.style.backgroundColor = '#1e1e1e';
|
| 208 |
+
modal.style.color = '#ffffff';
|
| 209 |
+
modal.style.border = '1px solid #444';
|
| 210 |
+
modal.style.boxShadow = '0px 4px 6px rgba(0, 0, 0, 0.8)';
|
| 211 |
+
closeButton.style.backgroundColor = '#007bff';
|
| 212 |
+
closeButton.style.color = 'white';
|
| 213 |
+
backdrop.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
|
| 214 |
+
}} else {{
|
| 215 |
+
modal.style.backgroundColor = '#ffffff';
|
| 216 |
+
modal.style.color = '#000000';
|
| 217 |
+
modal.style.border = '1px solid #ccc';
|
| 218 |
+
modal.style.boxShadow = '0px 4px 6px rgba(0, 0, 0, 0.2)';
|
| 219 |
+
closeButton.style.backgroundColor = '#007bff';
|
| 220 |
+
closeButton.style.color = 'white';
|
| 221 |
+
backdrop.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
|
| 222 |
+
}}
|
| 223 |
+
closeButton.style.marginTop = '10px';
|
| 224 |
+
closeButton.style.padding = '5px 10px';
|
| 225 |
+
closeButton.style.border = 'none';
|
| 226 |
+
closeButton.style.borderRadius = '5px';
|
| 227 |
+
closeButton.style.cursor = 'pointer';
|
| 228 |
+
}}
|
| 229 |
+
|
| 230 |
+
function closeTopicsModal() {{
|
| 231 |
+
document.getElementById('topicsModal').style.display = 'none';
|
| 232 |
+
document.getElementById('topicsBackdrop').style.display = 'none';
|
| 233 |
+
}}
|
| 234 |
</script>
|
| 235 |
""")
|
| 236 |
|