Spaces:
Sleeping
Sleeping
Commit ·
78c1ba6
1
Parent(s): 93ce607
Embed shared CSS/JS inline instead of file serving
Browse filesGradio file serving doesn't work reliably with Docker SDK.
Read chat-ui.css and chat-ui.js at startup and inject inline.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
app.py
CHANGED
|
@@ -220,6 +220,10 @@ def stream_question(
|
|
| 220 |
# Gradio app
|
| 221 |
# ---------------------------------------------------------------------------
|
| 222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
CUSTOM_HTML = """
|
| 224 |
<div id="explorer-app">
|
| 225 |
<div id="setup-panel">
|
|
@@ -249,8 +253,8 @@ CUSTOM_HTML = """
|
|
| 249 |
</div>
|
| 250 |
</div>
|
| 251 |
|
| 252 |
-
<
|
| 253 |
-
<script
|
| 254 |
<style>
|
| 255 |
#explorer-app { font-family: var(--font-family, 'Inter', system-ui, sans-serif); max-width: 800px; margin: 0 auto; }
|
| 256 |
#setup-panel { padding: 24px 0; }
|
|
@@ -576,4 +580,4 @@ if __name__ == "__main__":
|
|
| 576 |
print("WARNING: LH_ACCESS_TOKEN not set — app is unprotected")
|
| 577 |
|
| 578 |
app = build_app()
|
| 579 |
-
app.launch(server_name="0.0.0.0", server_port=7860
|
|
|
|
| 220 |
# Gradio app
|
| 221 |
# ---------------------------------------------------------------------------
|
| 222 |
|
| 223 |
+
_STATIC_DIR = Path(__file__).parent / "static"
|
| 224 |
+
_CHAT_UI_CSS = (_STATIC_DIR / "chat-ui.css").read_text() if (_STATIC_DIR / "chat-ui.css").exists() else ""
|
| 225 |
+
_CHAT_UI_JS = (_STATIC_DIR / "chat-ui.js").read_text() if (_STATIC_DIR / "chat-ui.js").exists() else ""
|
| 226 |
+
|
| 227 |
CUSTOM_HTML = """
|
| 228 |
<div id="explorer-app">
|
| 229 |
<div id="setup-panel">
|
|
|
|
| 253 |
</div>
|
| 254 |
</div>
|
| 255 |
|
| 256 |
+
<style>""" + _CHAT_UI_CSS + """</style>
|
| 257 |
+
<script>""" + _CHAT_UI_JS + """</script>
|
| 258 |
<style>
|
| 259 |
#explorer-app { font-family: var(--font-family, 'Inter', system-ui, sans-serif); max-width: 800px; margin: 0 auto; }
|
| 260 |
#setup-panel { padding: 24px 0; }
|
|
|
|
| 580 |
print("WARNING: LH_ACCESS_TOKEN not set — app is unprotected")
|
| 581 |
|
| 582 |
app = build_app()
|
| 583 |
+
app.launch(server_name="0.0.0.0", server_port=7860)
|