Spaces:
Running
Update app.py
Browse filesHere is how the newly configured layout translates into clean code mechanics, mapping perfectly to your orange suggestion markers:
Markers [2] & [3] (The Monolithic Configuration Row): We have packed the Gemini API Key, the Manuscript Name, the Bible Book box, the Chapter/Verse drop-downs, and the Hebrew Input Text String box all into a single, sweeping horizontal control banner right at the top of the interface.
The "Zero-Scroll" Button Relocation: The "Generate", "Clear", and "Copy for Google Docs" buttons have been placed side-by-side inside a compact utility belt directly below your inputs. This ensures that the copy button is immediately available to you without moving your eyes or mouse down the page!
Marker [4] (The Massive Table Theater Canvas): By compressing all your cockpit controls into the top 25% of the viewport, the bottom 75% of your browser window turns into a sprawling preview deck dedicated completely to displaying your table grids!
3 unmodified lines456789103 unmodified lines1415161718192021222324252627282912 unmodified lines424344454647484950515253545556575859606162637 unmodified lines71727374757677787980811 unmodified line83848586878889904 unmodified lines959697989910010110210310410510610710810911011111211311491 unmodified lines20620720820921021121294 unmodified lines3073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433 unmodified linesimport timeimport json# --- Shorashim Pro Premium Layout Engine ---custom_css = """/* Completely hide technical loading bars & indicators */.subpanel.loading, .generating, div[class*="loading"], .progress-wrap {3 unmodified linesoverflow: hidden !important;}/* Polished Minimalist Progress Window */.progress-container {padding: 12px;text-align: center;border: 1px solid #d4af37;border-radius: 6px;background-color: #111827;margin-bottom: 12px;}/* White Canvas Table Wrapper for clear document viewing */.white-canvas {display: flex;12 unmodified lines.gradio-container h1, .gradio-container h2, .gradio-container h3 {color: #d4af37 !important;font-weight: 600 !important;margin-top: 0px !important;}.gradio-container p, .gradio-container span {color: #9ca3af !important;}/* Compact Forms Fix */.form { gap: 8px !important; }/* Input Fields Customized with Gold Accent Focus Rings */input, textarea, select, .dropdown {border-radius: 6px !important;border: 1px solid #1f2937 !important;background-color: #111827 !important;color: #ffffff !important;padding: 6px 10px !important;}input:focus, textarea:focus, select:focus {border-color: #d4af37 !important;7 unmodified linesborder-radius: 6px !important;color: #ffffff !important;font-weight: bold !important;padding: 8px 16px !important;cursor: pointer;transition: opacity 0.2s;}button.primary-btn:hover { opacity: 0.9; }/* Secondary Actions / Clear Button (Dark Slate Accent) */button.secondary-btn {1 unmodified lineborder: 1px solid #374151 !important;border-radius: 6px !important;color: #e5e7eb !important;padding: 8px 16px !important;cursor: pointer;}/* Google Docs Copy Button (Shorashim Pro Signature Gold) */4 unmodified linescolor: #0b0f19 !important;font-weight: 800 !important;font-size: 14px !important;padding: 10px 20px !important;width: 100% !important;cursor: pointer;box-shadow: 0 4px 6px -1px rgba(212, 175, 55, 0.2);}/* Zero-Scroll Scroll Container Attached Safely via Native Column Class Selector */.scroll-viewport {max-height: 68vh !important;overflow-y: auto !important;border: 1px solid #1f2937 !important;border-radius: 8px !important;padding: 12px !important;background-color: #0d1321 !important;}"""91 unmodified linesenglish_cell_style = f"font-family: Arial, sans-serif !important; font-size: 14.6667px !important; color: #000000 !important; text-align: center !important; vertical-align: top; line-height: 1.0 !important; {base_cell}"heading_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18.6667px !important; color: #000000 !important; text-align: center !important; vertical-align: middle; line-height: 1.0 !important; {base_cell}"html_output = ['<div id="table-payload" class="white-canvas" style="background-color: #ffffff; padding: 15px; border-radius: 6px; display: inline-block; width: 100%; box-sizing: border-box; text-align: center;">']table_chunks = calculate_clean_chunks(words_data)html_output.append(f'<table style="{table_style}" align="center" cellpadding="5" cellspacing="0">')94 unmodified lineswith gr.Blocks(title="Shorashim Pro Interlinear Workspace") as demo:gr.HTML("<div style='background: linear-gradient(135deg, #111827 0%, #0b0f19 100%); padding: 12px; border-radius: 8px; margin-bottom: 12px; text-align: center; border: 1px solid #d4af37;'>""<h1 style='margin: 0 0 2px 0; font-size: 22px; font-weight: 700; color: #d4af37;'>π Shorashim Pro Workspace</h1>""<p style='margin: 0; font-size: 12px; color: #9ca3af;'>Zero-Scroll Balanced 7-Inch Monolithic Document Publisher</p>""</div>")# 2-Column Responsive Workspace Split Grid FIXEDwith gr.Row(equal_height=False):# --- LEFT COLUMN: Input Panel Control Deck (35% Space) ---with gr.Column(scale=35):gr.Markdown("### π οΈ Configuration Panel")api_key_input = gr.Textbox(label="π Gemini API Key", type="password", placeholder="Key securely loaded...")manuscript_input = gr.Textbox(label="π Manuscript Reference", value="Marseilles MS-24")book_input = gr.Textbox(label="π Bible Book", value="Luke")with gr.Row():chapter_input = gr.Dropdown(choices=[str(x) for x in range(1, 151)], label="Chapter", value="11", allow_custom_value=True)verse_input = gr.Dropdown(choices=[str(x) for x in range(1, 177)], label="Verse", value="49", allow_custom_value=True)text_string_input = gr.Textbox(label="π Hebrew Input Text String", placeholder="Paste text line segments here...", lines=3)with gr.Row():submit_btn = gr.Button("π Generate", elem_classes=["primary-btn"])clear_btn = gr.Button("π§Ή Clear", elem_classes=["secondary-btn"])# --- RIGHT COLUMN: Document Output Pavilion Viewport (65% Space) FIXED NATIVE LAYOUT ---with gr.Column(scale=65, elem_classes=["scroll-viewport"]):copy_btn = gr.Button("π Copy for Google Docs", elem_classes=["gold-copy-btn"], visible=False)gr.HTML("<div style='margin-bottom: 8px;'></div>")output_html = gr.HTML(label="Shorashim Document Frame Canvas")demo.load(fn=None, inputs=None, outputs=None, js=sticky_session_and_layout_js)3 unmodified lines456789103 unmodified lines14151617181912 unmodified lines3233343536373839404142434445464748497 unmodified lines5758596061626364651 unmodified line67686970717273744 unmodified lines7980818283848586878889909192939495969791 unmodified lines18919019119219319419594 unmodified lines2902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313 unmodified linesimport timeimport json# --- Shorashim Pro Ultra-Compact Horizontal Layout Engine ---custom_css = """/* Completely hide technical loading bars & indicators */.subpanel.loading, .generating, div[class*="loading"], .progress-wrap {3 unmodified linesoverflow: hidden !important;}/* White Canvas Table Wrapper for clear document viewing */.white-canvas {display: flex;12 unmodified lines.gradio-container h1, .gradio-container h2, .gradio-container h3 {color: #d4af37 !important;font-weight: 600 !important;margin: 0px !important;}.gradio-container p, .gradio-container span {color: #9ca3af !important;}/* Input Fields Customized with Gold Accent Focus Rings */input, textarea, select, .dropdown {border-radius: 6px !important;border: 1px solid #1f2937 !important;background-color: #111827 !important;color: #ffffff !important;}input:focus, textarea:focus, select:focus {border-color: #d4af37 !important;7 unmodified linesborder-radius: 6px !important;color: #ffffff !important;font-weight: bold !important;cursor: pointer;height: 42px !important;}/* Secondary Actions / Clear Button (Dark Slate Accent) */button.secondary-btn {1 unmodified lineborder: 1px solid #374151 !important;border-radius: 6px !important;color: #e5e7eb !important;cursor: pointer;height: 42px !important;}/* Google Docs Copy Button (Shorashim Pro Signature Gold) */4 unmodified linescolor: #0b0f19 !important;font-weight: 800 !important;font-size: 14px !important;cursor: pointer;box-shadow: 0 4px 6px -1px rgba(212, 175, 55, 0.2);height: 42px !important;}/* Fixed Table Theater Container Viewport */.theater-viewport {border: 1px solid #1f2937 !important;border-radius: 8px !important;padding: 16px !important;background-color: #0d1321 !important;margin-top: 12px !important;min-height: 45vh !important;}"""91 unmodified linesenglish_cell_style = f"font-family: Arial, sans-serif !important; font-size: 14.6667px !important; color: #000000 !important; text-align: center !important; vertical-align: top; line-height: 1.0 !important; {base_cell}"heading_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18.6667px !important; color: #000000 !important; text-align: center !important; vertical-align: middle; line-height: 1.0 !important; {base_cell}"html_output = ['<div id="table-payload" class="white-canvas" style="background-color: #ffffff; padding: 15px; border-radius: 8px; display: inline-block; width: 100%; box-sizing: border-box; text-align: center;">']table_chunks = calculate_clean_chunks(words_data)html_output.append(f'<table style="{table_style}" align="center" cellpadding="5" cellspacing="0">')94 unmodified lineswith gr.Blocks(title="Shorashim Pro Interlinear Workspace") as demo:gr.HTML("<div style='background: linear-gradient(135deg, #111827 0%, #0b0f19 100%); padding: 10px; border-radius: 6px; margin-bottom: 10px; text-align: center; border: 1px solid #d4af37;'>""<h1 style='margin: 0 0 2px 0; font-size: 20px; font-weight: 700; color: #d4af37;'>π Shorashim Pro Workspace</h1>""<p style='margin: 0; font-size: 12px; color: #9ca3af;'>Convert raw Hebrew text strings into BEI style interlinear tables</p>""</div>")with gr.Accordion("π API Key Setup Instructions", open=False):gr.Markdown("1. Visit [Google AI Studio](https://aistudio.google.com/).\n""2. Click the **Get API Key** button on the left workspace menu.\n""3. Click **Create API Key** (or select your existing default placeholder string).\n""4. Copy your generated string key, paste it into the **Gemini API Key** input element below, and the app will cache it safely!")# --- MONOLITHIC COCKPIT INPUT ROW ---with gr.Row():api_key_input = gr.Textbox(label="π Gemini API Key", type="password", placeholder="Key safely saved...", scale=2)manuscript_input = gr.Textbox(label="π Manuscript", value="Marseilles MS-24", scale=2)book_input = gr.Textbox(label="π Book", value="Luke", scale=2)with gr.Column(scale=2):with gr.Row():chapter_input = gr.Dropdown(choices=[str(x) for x in range(1, 151)], label="Ch.", value="11", allow_custom_value=True)verse_input = gr.Dropdown(choices=[str(x) for x in range(1, 177)], label="Ver.", value="49", allow_custom_value=True)text_string_input = gr.Textbox(label="π Hebrew Verses Input String", placeholder="Paste line segments...", scale=4)# --- ZERO-SCROLL CONTROL BELT HUB ---with gr.Row():submit_btn = gr.Button("π Generate Canvas", elem_classes=["primary-btn"], scale=3)clear_btn = gr.Button("π§Ή Clear Input", elem_classes=["secondary-btn"], scale=2)copy_btn = gr.Button("π Copy for Google Docs", elem_classes=["gold-copy-btn"], visible=False, scale=5)# --- FULL WIDTH THEATER CANVAS VIEWPORT ---with gr.Column(elem_classes=["theater-viewport"]):output_html = gr.HTML(label="Shorashim Frame Canvas")demo.load(fn=None, inputs=None, outputs=None, js=sticky_session_and_layout_js)