Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -164,6 +164,22 @@ def get_agent():
|
|
| 164 |
if agent is None:
|
| 165 |
agent = create_langchain_agent()
|
| 166 |
return agent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
# --- UI: MathJax Configuration ---
|
| 169 |
mathjax_config = '''
|
|
@@ -313,6 +329,7 @@ def create_interface():
|
|
| 313 |
) as demo:
|
| 314 |
# Add head content and MathJax
|
| 315 |
gr.HTML(html_head_content)
|
|
|
|
| 316 |
gr.HTML('<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>')
|
| 317 |
gr.HTML(mathjax_config)
|
| 318 |
|
|
|
|
| 164 |
if agent is None:
|
| 165 |
agent = create_langchain_agent()
|
| 166 |
return agent
|
| 167 |
+
|
| 168 |
+
Force_LightMode = '''
|
| 169 |
+
<script>
|
| 170 |
+
// Force light theme in Gradio
|
| 171 |
+
window.addEventListener('DOMContentLoaded', function () {
|
| 172 |
+
const gradioURL = window.location.href;
|
| 173 |
+
const url = new URL(gradioURL);
|
| 174 |
+
const currentTheme = url.searchParams.get('__theme');
|
| 175 |
+
|
| 176 |
+
if (currentTheme !== 'light') {
|
| 177 |
+
url.searchParams.set('__theme', 'light');
|
| 178 |
+
window.location.replace(url.toString());
|
| 179 |
+
}
|
| 180 |
+
});
|
| 181 |
+
</script>
|
| 182 |
+
'''
|
| 183 |
|
| 184 |
# --- UI: MathJax Configuration ---
|
| 185 |
mathjax_config = '''
|
|
|
|
| 329 |
) as demo:
|
| 330 |
# Add head content and MathJax
|
| 331 |
gr.HTML(html_head_content)
|
| 332 |
+
gr.HTML(force_light_mode)
|
| 333 |
gr.HTML('<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>')
|
| 334 |
gr.HTML(mathjax_config)
|
| 335 |
|