Spaces:
Running
Running
Complete UI rebuild: remove broken Gradio overrides, match reference layout
Browse files
app.py
CHANGED
|
@@ -239,12 +239,6 @@ def extract_body(html_str):
|
|
| 239 |
|
| 240 |
body_html = extract_body(custom_html_content)
|
| 241 |
|
| 242 |
-
# Remove the external CSS/JS link tags from the body HTML since Gradio handles them
|
| 243 |
-
# Remove <link rel="stylesheet" href="/static/style.css...">
|
| 244 |
-
body_html = re.sub(r'<link[^>]*href=["\']\/static\/style\.css[^>]*>', '', body_html)
|
| 245 |
-
# Remove <script ... src="/static/app.js..."></script>
|
| 246 |
-
body_html = re.sub(r'<script[^>]*src=["\']\/static\/app\.js[^>]*>[^<]*<\/script>', '', body_html)
|
| 247 |
-
|
| 248 |
# Inject the JS inline at the end of the body
|
| 249 |
inject_script = f"""
|
| 250 |
<script type="module">
|
|
@@ -253,16 +247,22 @@ inject_script = f"""
|
|
| 253 |
</script>
|
| 254 |
"""
|
| 255 |
|
| 256 |
-
|
| 257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
|
| 259 |
# ── Create the Gradio Blocks app ────────────────────────────────────────
|
| 260 |
with gr.Blocks(
|
| 261 |
title="DeepSeek V4 Flash",
|
| 262 |
-
css=custom_css,
|
| 263 |
head="""
|
| 264 |
-
<meta
|
| 265 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 266 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 267 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 268 |
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
|
|
|
|
| 239 |
|
| 240 |
body_html = extract_body(custom_html_content)
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
# Inject the JS inline at the end of the body
|
| 243 |
inject_script = f"""
|
| 244 |
<script type="module">
|
|
|
|
| 247 |
</script>
|
| 248 |
"""
|
| 249 |
|
| 250 |
+
full_injected_html = body_html + inject_script
|
| 251 |
+
|
| 252 |
+
# Minimal Gradio overrides to make the HTML component full viewport
|
| 253 |
+
gradio_overrides = """
|
| 254 |
+
/* Make Gradio container fill the viewport */
|
| 255 |
+
.gradio-container { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
|
| 256 |
+
.gr-app, .main, .wrap { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
|
| 257 |
+
html, body { overflow: hidden !important; }
|
| 258 |
+
"""
|
| 259 |
|
| 260 |
# ── Create the Gradio Blocks app ────────────────────────────────────────
|
| 261 |
with gr.Blocks(
|
| 262 |
title="DeepSeek V4 Flash",
|
| 263 |
+
css=gradio_overrides + custom_css,
|
| 264 |
head="""
|
| 265 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
|
|
|
| 266 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 267 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 268 |
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
|