Spaces:
Sleeping
Sleeping
13th commit
Browse files
app.py
CHANGED
|
@@ -449,8 +449,46 @@ def load_example(example_name):
|
|
| 449 |
"""Load example code"""
|
| 450 |
return example_codes.get(example_name, "")
|
| 451 |
|
| 452 |
-
# Create Gradio interface
|
| 453 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
gr.Markdown("""
|
| 455 |
# 🎬 Manim Animation Generator
|
| 456 |
|
|
@@ -480,7 +518,8 @@ with gr.Blocks(title="Manim Animation Generator", theme=gr.themes.Soft()) as app
|
|
| 480 |
label="Manim Code",
|
| 481 |
language="python",
|
| 482 |
lines=20,
|
| 483 |
-
value=example_codes["Simple Square"]
|
|
|
|
| 484 |
)
|
| 485 |
|
| 486 |
with gr.Row():
|
|
|
|
| 449 |
"""Load example code"""
|
| 450 |
return example_codes.get(example_name, "")
|
| 451 |
|
| 452 |
+
# Create Gradio interface with custom CSS for fixed height code input
|
| 453 |
+
with gr.Blocks(
|
| 454 |
+
title="Manim Animation Generator",
|
| 455 |
+
theme=gr.themes.Soft(),
|
| 456 |
+
css="""
|
| 457 |
+
/* Fix the height of the code input and add scrollbar */
|
| 458 |
+
.code-input textarea {
|
| 459 |
+
height: 400px !important;
|
| 460 |
+
max-height: 400px !important;
|
| 461 |
+
min-height: 400px !important;
|
| 462 |
+
overflow-y: auto !important;
|
| 463 |
+
resize: none !important;
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
/* Ensure the parent container doesn't expand */
|
| 467 |
+
.code-input {
|
| 468 |
+
height: 400px !important;
|
| 469 |
+
max-height: 400px !important;
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
/* Style the scrollbar for better visibility */
|
| 473 |
+
.code-input textarea::-webkit-scrollbar {
|
| 474 |
+
width: 8px;
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
.code-input textarea::-webkit-scrollbar-track {
|
| 478 |
+
background: #f1f1f1;
|
| 479 |
+
border-radius: 4px;
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
.code-input textarea::-webkit-scrollbar-thumb {
|
| 483 |
+
background: #888;
|
| 484 |
+
border-radius: 4px;
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
.code-input textarea::-webkit-scrollbar-thumb:hover {
|
| 488 |
+
background: #555;
|
| 489 |
+
}
|
| 490 |
+
"""
|
| 491 |
+
) as app:
|
| 492 |
gr.Markdown("""
|
| 493 |
# 🎬 Manim Animation Generator
|
| 494 |
|
|
|
|
| 518 |
label="Manim Code",
|
| 519 |
language="python",
|
| 520 |
lines=20,
|
| 521 |
+
value=example_codes["Simple Square"],
|
| 522 |
+
elem_classes=["code-input"] # Add custom CSS class
|
| 523 |
)
|
| 524 |
|
| 525 |
with gr.Row():
|