Spaces:
Running
Running
Update app.py
Browse files35 unmodified lines3637383940414224 unmodified lines676869707172734 unmodified lines787980818283843 unmodified lines888990919293942 unmodified lines9798991001011021031041051061073 unmodified lines1111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701713 unmodified lines1751761771781791801811821831841851861871881891901911921931941951961971981992002012022031 unmodified line2052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592603 unmodified lines26426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942035 unmodified lines.gradio-container, html, body {background-color: #0b0f19 !important;font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;max-width: 98% !important; /* Overrides Gradio's max width to use the full screen */}/* Antique Gold Typography Highlights */24 unmodified linesoutline: none !important;}/* Primary Generate Action Button (BEI Emerald Teal Accent) */button.primary-btn {background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;border: none !important;4 unmodified linesheight: 42px !important;}/* Secondary Actions / Clear Button (Dark Slate Gray) */button.secondary-btn {background-color: #1f2937 !important;border: 1px solid #374151 !important;3 unmodified linesheight: 42px !important;}/* Google Docs Copy Button (BEI Signature Antique Gold Fill) */button.gold-copy-btn {background: linear-gradient(135deg, #aa820a 0%, #d4af37 100%) !important;border: none !important;2 unmodified linesfont-weight: 800 !important;font-size: 14px !important;cursor: pointer;box-shadow: 0 4px 6px -1px rgba(212, 175, 55, 0.2);height: 42px !important;}/* Extended Document Theater Container Canvas Viewport Window */.theater-viewport {border: 1px solid #1f2937 !important;border-radius: 8px !important;3 unmodified linesmin-height: 48vh !important;}/* Custom Gold Spinner Arrows for Number Inputs (Maximized Size) */.gradio-container input[type="number"]::-webkit-inner-spin-button,.gradio-container input[type="number"]::-webkit-outer-spin-button {-webkit-appearance: none !important;appearance: none !important;display: block !important;opacity: 1 !important;visibility: visible !important;width: 32px !important; /* Expanded to fill the right side of the box */height: 100% !important;min-height: 42px !important;background-color: #111827 !important;/* Redrawn SVG for broader, bolder triangles */background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d4af37'%3E%3Cpath d='M12 3l-8 8h16zM12 21l-8-8h16z'/%3E%3C/svg%3E") !important;background-size: 24px !important; /* Scales the graphic up to fill the space */background-repeat: no-repeat !important;background-position: center !important;cursor: pointer !important;border-left: 1px solid #1f2937 !important;}/* Allow full text but force all labels to a uniform two-line height */.gradio-container label span {white-space: normal !important;display: flex !important;align-items: flex-end !important;min-height: 42px !important;}"""sticky_session_and_layout_js = """function() {const removeHeaderBlock = () => {const hfHeader = document.querySelector('header');const spaceHeader = document.querySelector('div[class*="space-header"]');if (hfHeader) hfHeader.remove();if (spaceHeader) spaceHeader.remove();document.querySelectorAll('div').forEach(div => {if (window.getComputedStyle(div).position === 'fixed' && div.innerHTML.includes('fizzickschick')) {div.remove();}});};removeHeaderBlock();setTimeout(removeHeaderBlock, 500);setTimeout(removeHeaderBlock, 1500);setTimeout(removeHeaderBlock, 3000);setTimeout(() => {const inputSelectors = '.gradio-container input, .gradio-container textarea, .gradio-container select';const loadSavedValues = () => {3 unmodified linesif (savedValue && input.value !== savedValue) {input.value = savedValue;input.dispatchEvent(new Event('input', { bubbles: true }));input.dispatchEvent(new Event('change', { bubbles: true }));}});};document.addEventListener('input', (e) => {document.querySelectorAll(inputSelectors).forEach((input, index) => {if (input === e.target) {localStorage.setItem('table_gen_v6_cache_' + index, input.value);}});});document.addEventListener('change', (e) => {document.querySelectorAll(inputSelectors).forEach((input, index) => {if (input === e.target) {localStorage.setItem('table_gen_v6_cache_' + index, input.value);}});});loadSavedValues();setTimeout(loadSavedValues, 800);}, 1200);}"""1 unmodified lineMODEL_NAME = "gemini-3.1-flash-lite"def clean_hyphens_for_docs(text_string):if not text_string:return ""return str(text_string).replace("-", "‑")def calculate_clean_chunks(words_data):"""Slices input elements into structured blocks of up to 7 columns max."""chunks = []current_chunk = []word_index = 0while word_index < len(words_data):current_limit = 6 if len(chunks) == 0 else 7word = words_data[word_index]current_chunk.append(word)if len(current_chunk) == current_limit:chunks.append(current_chunk)current_chunk = []word_index += 1if current_chunk:chunks.append(current_chunk)return chunksdef build_html_tables(manuscript, reference, words_data):column_width_in = 1.0total_slots = 7total_table_width_in = 7.0table_style = (f"width: {total_table_width_in}in !important; min-width: {total_table_width_in}in !important; "f"max-width: {total_table_width_in}in !important; table-layout: fixed !important; border-collapse: collapse; ""direction: rtl; border: 1pt solid #b7b7b7; background-color: #ffffff; ""line-height: 1.0 !important; height: auto; margin-left: auto !important; margin-right: auto !important;")# 0.069in padding layout parameters attached cleanly to native td elementsbase_cell = "border: 1pt solid #b7b7b7; padding: 0.069in !important; height: auto; overflow: hidden; white-space: normal !important; word-wrap: break-word !important; box-sizing: border-box !important;"hebrew_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 24px !important; color: #000000 !important; text-align: right !important; vertical-align: middle; {base_cell}"english_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)# MONOLITHIC MATRIX FRAME: Keeps all verse rows bound inside one unified table framehtml_output.append(f'<table style="{table_style}" align="center" cellpadding="5" cellspacing="0">')html_output.append(' <colgroup>')for _ in range(total_slots):html_output.append(f' <col style="width: {column_width_in}in !important; min-width: {column_width_in}in !important; max-width: {column_width_in}in !important;">')html_output.append(' </colgroup>')for idx, current_chunk in enumerate(table_chunks):is_first = (idx == 0)is_last_table = (idx == len(table_chunks) - 1)allocated_slots = len(current_chunk) + (1 if is_first else 0)3 unmodified linescurrent_chunk.append({"hebrew": " ", "transliteration": " ", "translation": " ", "morphology": " "})allocated_slots += 1# --- ROW 1: Right-Justified Hebrew Word Units ---html_output.append(' <tr style="height: auto; line-height: 1.0 !important;">')if is_first:html_output.append(f' <td style="{heading_cell_style}">{reference}</td>')for word in current_chunk:html_output.append(f' <td style="{hebrew_cell_style}">{word.get("hebrew", " ")}</td>')html_output.append(' </tr>')# --- ROW 2: Centered English Multi-Line Stacks ---html_output.append(' <tr style="height: auto; line-height: 1.0 !important;">')if is_first:formatted_manuscript = manuscript.replace(" ", "<br>") if " " in manuscript else manuscripthtml_output.append(f' <td style="{heading_cell_style}">{formatted_manuscript}</td>')is_first = Falsefor word in current_chunk:if word.get("hebrew") != " " and word.get("hebrew") != " ":t_lit = clean_hyphens_for_docs(word.get("transliteration", ""))t_lat = clean_hyphens_for_docs(word.get("translation", ""))morph = clean_hyphens_for_docs(word.get("morphology", ""))content = f'{t_lit}<br>{t_lat}<br>{morph}'html_output.append(f' <td class="english-cell" style="{english_cell_style}">{content}</td>')else:html_output.append(f' <td style="{english_cell_style}"> </td>')html_output.append(' </tr>')if not is_last_table:html_output.append(f'<tr style="height: 12pt !important;"><td colspan="{total_slots}" style="border-left: none; border-right: none; border-bottom: none; height: 12pt !important; background-color: #ffffff; padding: 0 !important; margin: 0 !important;"> </td></tr>')html_output.append('</table>')html_output.append('</div>')return "".join(html_output)def generate_table_code(api_key, manuscript_name, book, chapter, verse, text_string):if not api_key:return "<p style='color:red; text-align:center;'>β Error: Please enter your Gemini API key.</p>", gr.update(visible=False)reference_header = f"{book} {chapter}:{verse}"try:client = genai.Client(api_key=api_key)system_instruction_text = ("You are a strict linguistic conversion engine mapping raw Hebrew text into clean JSON lists. ""You map words from right to left into transliteration, translation, and morphology components ""matching your specific instructions. Return no conversation or markdown code block markers.")prompt = f"""Analyze this Hebrew text string word-by-word from right to left: "{text_string}"Populate a flat JSON array containing objects matching this schema format exactly:{{"hebrew": "The exact raw Hebrew word token","transliteration": "The syllabic transliteration strictly following the provided rules","translation": "The direct lowercase contextual translation","morphology": "The clean root-only structural morphology format string"}}STRICT BEI TRANSLITERATION MAPPING TABLES:- VOCAL_SHEVA: "α΅", HATAF_SEGOL: "e", HATAF_PATAH: "a", HATAF_QAMATS: "o", HIRIQ: "i", TSERE: "ey", SEGOL: "e", PATAH: "a", QAMATS: "a", HOLAM: "o", QUBUTS: "oo", MAQAF: "-", PASEQ: "Χ", SOF_PASUQ: "."- HIRIQ_YOD: "ee", TSERE_YOD: "ey", SEGOL_YOD: "ey", SHUREQ: "oo", HOLAM_VAV: "o", QAMATS_HE: "a", SEGOL_HE: "eh", TSERE_HE: "e", MS_SUFX: "av"- ALEF: "", BET: "v", BET_DAGESH: "b", GIMEL: "g", DALET: "d", HE: "h", VAV: "v", ZAYIN: "z", HET: "kh", TET: "t", YOD: "y", KAF: "kh", KAF_DAGESH: "k", FINAL_KAF: "kh", LAMED: "l", MEM: "m", FINAL_MEM: "m", NUN: "n", FINAL_NUN: "n", SAMEKH: "s", AYIN: "", PE: "f", PE_DAGESH: "p", FINAL_PE: "f", TSADI: "ts", FINAL_TSADI: "ts", QOF: "q", RESH: "r", SHIN: "sh", SIN: "s", TAV: "t"- SPECIAL CLUSTERS: Χ©ΦΌΧ = "sh", Χ¦ΦΌ = "ts", ΧΦ°Χ¨ΧΦΌΧ©ΦΈΧΧΦ΄Φ·Χ = "yα΅Β·rooΒ·shaΒ·laΜ±Β·yeem", ΧΦ΅Χ©ΧΧΦΌΧ’Φ· = "YeyΒ·shooΜ±Β·a"- DIVINE_NAME: "Yα΅Β·hoΒ·vaΜ±h", DIVINE_NAME_ELOHIM: "YeΒ·hoΒ·veeΜ±h"CRITICAL SYLLABLE SEPARATOR RULE:- You MUST use the middle dot symbol (Β·, ALT+0183) exclusively to separate syllables in the transliteration field (e.g., "gaΒ·dol", "miΒ·beyΜ±t", "haΒ·meΒ·leΜ±kh"). Never vary from this separator mark.CRITICAL ROOT-ONLY MORPHOLOGY LOGIC:- Report ONLY on the core 'root' properties of a word unit. Strip out all prefix or suffix clutter from the morphology description (e.g. for 'mi'beyt', evaluate only 'house' -> 'nms constr').- Abbreviations: verb=v, noun=n, adverb=adv, adjective=adj, conjunction=conj, particle=part, preposition=prep, pronoun=pron, proper name=name, definite direct object=ddo, number=#, interjection=intj, construct=constr. Do not include periods.- Binyan forms: Pa'al, Nif'al, Pi'el, Pu'al, Hif'il, Huf'al, Hitpa'el. Never use "Qal".- Tense forms: perfect=perf, imperfect=imp, participle=ptcpl.- Structure formatting: part_of_speech + space + binyan (if app) + space + tense (if app) + person/gender/number combo (no inner spacing, e.g., '3ms', '2mp'). Example: "v Pa'al perf 3ms" or "n mp constr"."""response = client.models.generate_content(model=MODEL_NAME, contents=prompt,config=types.GenerateContentConfig(system_instruction=system_instruction_text,response_mime_type="application/json", candidate_count=1))raw_json_data = json.loads(response.text.strip())final_table_html = build_html_tables(manuscript_name, reference_header, raw_json_data)return final_table_html, gr.update(visible=True)except Exception as e:return f"<p style='color:red; text-align:center;'>β Error: {str(e)}</p>", gr.update(visible=False)copy_btn_js = """function() {const payload = document.getElementById('table-payload').innerHTML;const blob = new Blob([payload], { type: 'text/html' });const data = [new ClipboardItem({ 'text/html': blob })];navigator.clipboard.write(data).then(() => {alert('π Tables successfully copied to clipboard with exact BEI padding alignment!');}).catch(err => { alert('β Clipboard Copy Failed: ' + err); });}"""with gr.Blocks(title="Shorashim Pro Interlinear Workspace") as demo:# Header Panel [Marker 1]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: 28px; font-weight: 700; color: #d4af37;'>π Shorashim Pro Workspace</h1>""<p style='margin: 0; font-size: 14px; color: #9ca3af;'>Convert raw Hebrew text strings into BEI style interlinear tables</p>""</div>")# API Verification Guideline Boxwith gr.Accordion("π API Key Setup Instructions", open=True):gr.Markdown("1. Visit [Google AI Studio](https://aistudio.google.com/).\n\n""2. Click the **Get API Key** button on the left menu.\n\n""3. Click **Create API Key** (or use your default layout string).\n\n""4. Copy your string token and paste it into the input box below. ""Click <a href='https://youtu.be/Uyn-P2nRvDA?si=LQi2U0tLsY-zE7a9' target='_blank' style='color: #d4af37; font-weight: bold; text-decoration: underline;'>here</a> to view a short how-to video.")# --- MONOLITHIC HORIZONTAL COCKPIT INPUT ROW [Markers 2 & 3] ---with gr.Row():api_key_input = gr.Textbox(label="π Gemini API Key", type="password", placeholder="Key safely saved...", scale=2, min_width=100)manuscript_input = gr.Textbox(label="π Manuscript Reference", value=None, scale=2)book_input = gr.Textbox(label="π Bible Book", value=None, scale=2)# with gr.Column(scale=2):chapter_input = gr.Number(label="Chapter", value=None, precision=0, scale=1)verse_input = gr.Number(label="Verse", value=None, precision=0, scale=1)text_string_input = gr.Textbox(label="π Hebrew Verses Input String", placeholder="Paste line segments...", scale=4)# --- ZERO-SCROLL CONTROL PLATFORM 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)# --- MARKER [4]: EXTENDED FULL-WIDTH PREVIEW 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)submit_btn.click(fn=generate_table_code,inputs=[api_key_input, manuscript_input, book_input, chapter_input, verse_input, text_string_input],outputs=[output_html, copy_btn],show_progress="hidden")clear_btn.click(fn=None, inputs=[], outputs=[text_string_input], js="() => ''")copy_btn.click(fn=None, js=copy_btn_js)demo.queue().launch(server_name="0.0.0.0", server_port=7860, css=custom_css)35 unmodified lines3637383940414224 unmodified lines676869707172734 unmodified lines787980818283843 unmodified lines888990919293942 unmodified lines9798991001011021031041053 unmodified lines1091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461473 unmodified lines1511521531541551561571581591601611621631641651 unmodified line1671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042053 unmodified lines20921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126235 unmodified lines.gradio-container, html, body {background-color: #0b0f19 !important;font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;max-width: 98% !important;}/* Antique Gold Typography Highlights */24 unmodified linesoutline: none !important;}/* Primary Generate Action Button */button.primary-btn {background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;border: none !important;4 unmodified linesheight: 42px !important;}/* Secondary Actions / Clear Button */button.secondary-btn {background-color: #1f2937 !important;border: 1px solid #374151 !important;3 unmodified linesheight: 42px !important;}/* Google Docs Copy Button */button.gold-copy-btn {background: linear-gradient(135deg, #aa820a 0%, #d4af37 100%) !important;border: none !important;2 unmodified linesfont-weight: 800 !important;font-size: 14px !important;cursor: pointer;height: 42px !important;}.theater-viewport {border: 1px solid #1f2937 !important;border-radius: 8px !important;3 unmodified linesmin-height: 48vh !important;}/* Custom Gold Spinner Arrows */.gradio-container input[type="number"]::-webkit-inner-spin-button,.gradio-container input[type="number"]::-webkit-outer-spin-button {-webkit-appearance: none !important;appearance: none !important;display: block !important;width: 32px !important;height: 100% !important;min-height: 42px !important;background-color: #111827 !important;background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d4af37'%3E%3Cpath d='M12 3l-8 8h16zM12 21l-8-8h16z'/%3E%3C/svg%3E") !important;background-size: 24px !important;background-repeat: no-repeat !important;background-position: center !important;cursor: pointer !important;border-left: 1px solid #1f2937 !important;}.gradio-container label span {white-space: normal !important;display: flex !important;align-items: flex-end !important;min-height: 42px !important;}"""sticky_session_and_layout_js = """function() {const removeHeaderBlock = () => {const hfHeader = document.querySelector('header');if (hfHeader) hfHeader.remove();};removeHeaderBlock();setTimeout(() => {const inputSelectors = '.gradio-container input, .gradio-container textarea, .gradio-container select';const loadSavedValues = () => {3 unmodified linesif (savedValue && input.value !== savedValue) {input.value = savedValue;input.dispatchEvent(new Event('input', { bubbles: true }));}});};document.addEventListener('input', (e) => {document.querySelectorAll(inputSelectors).forEach((input, index) => {if (input === e.target) localStorage.setItem('table_gen_v6_cache_' + index, input.value);});});loadSavedValues();}, 1200);}"""1 unmodified lineMODEL_NAME = "gemini-3.1-flash-lite"def clean_hyphens_for_docs(text_string):return str(text_string).replace("-", "‑") if text_string else ""def calculate_clean_chunks(words_data):chunks = []current_chunk = []word_index = 0while word_index < len(words_data):current_limit = 6 if len(chunks) == 0 else 7current_chunk.append(words_data[word_index])if len(current_chunk) == current_limit:chunks.append(current_chunk)current_chunk = []word_index += 1if current_chunk: chunks.append(current_chunk)return chunksdef build_html_tables(manuscript, reference, words_data):column_width_in, total_slots = 1.0, 7table_style = f"width: 7.0in !important; min-width: 7.0in !important; max-width: 7.0in !important; table-layout: fixed !important; border-collapse: collapse; direction: rtl; border: 1pt solid #b7b7b7; background-color: #ffffff; line-height: 1.0 !important;"base_cell = "border: 1pt solid #b7b7b7; padding: 0.069in !important; height: auto; overflow: hidden; white-space: normal !important;"hebrew_cell = f"font-family: 'Times New Roman', serif !important; font-size: 24px !important; color: #000000 !important; text-align: right !important; {base_cell}"english_cell = f"font-family: Arial, sans-serif !important; font-size: 14.6667px !important; color: #000000 !important; text-align: center !important; {base_cell}"heading_cell = f"font-family: 'Times New Roman', serif !important; font-size: 18.6667px !important; color: #000000 !important; text-align: center !important; {base_cell}"html_output = ['<div id="table-payload" class="white-canvas">']table_chunks = calculate_clean_chunks(words_data)for idx, current_chunk in enumerate(table_chunks):html_output.append(f'<table style="{table_style}" align="center" cellpadding="5" cellspacing="0"><colgroup>')for _ in range(total_slots):html_output.append(f'<col style="width: {column_width_in}in !important;">')html_output.append('</colgroup>')is_first = (idx == 0)is_last_table = (idx == len(table_chunks) - 1)allocated_slots = len(current_chunk) + (1 if is_first else 0)3 unmodified linescurrent_chunk.append({"hebrew": " ", "transliteration": " ", "translation": " ", "morphology": " "})allocated_slots += 1html_output.append('<tr>')if is_first: html_output.append(f'<td style="{heading_cell}">{reference}</td>')for word in current_chunk:html_output.append(f'<td style="{hebrew_cell}">{word.get("hebrew", " ")}</td>')html_output.append('</tr><tr>')if is_first:f_man = manuscript.replace(" ", "<br>") if " " in manuscript else manuscripthtml_output.append(f'<td style="{heading_cell}">{f_man}</td>')for word in current_chunk:if word.get("hebrew") != " ":content = f'{clean_hyphens_for_docs(word.get("transliteration", ""))}<br>{clean_hyphens_for_docs(word.get("translation", ""))}<br>{clean_hyphens_for_docs(word.get("morphology", ""))}'html_output.append(f'<td style="{english_cell}">{content}</td>')else: html_output.append(f'<td style="{english_cell}"> </td>')html_output.append('</tr></table><br><br>')html_output.append('</div>')return "".join(html_output)def generate_table_code(api_key, manuscript_name, book, chapter, verse, text_string):if not api_key: return "β Error: Please enter API key.", gr.update(visible=False)reference_header = f"{book} {chapter}:{verse}"try:client = genai.Client(api_key=api_key)prompt = f'Analyze "{text_string}" into JSON with hebrew, transliteration, translation, morphology fields.'response = client.models.generate_content(model=MODEL_NAME, contents=prompt, config=types.GenerateContentConfig(response_mime_type="application/json"))return build_html_tables(manuscript_name, reference_header, json.loads(response.text.strip())), gr.update(visible=True)except Exception as e: return f"β Error: {str(e)}", gr.update(visible=False)copy_btn_js = "() => { const p = document.getElementById('table-payload').innerHTML; navigator.clipboard.write([new ClipboardItem({'text/html': new Blob([p], {type: 'text/html'})})]); alert('π Copied!'); }"with gr.Blocks(title="Shorashim Pro Workspace") as demo:gr.HTML("<div style='text-align: center; border: 1px solid #d4af37; padding: 10px; border-radius: 6px;'><h1>π Shorashim Pro Workspace</h1></div>")with gr.Row():api_key_input = gr.Textbox(label="π Gemini API Key", type="password", scale=2)manuscript_input = gr.Textbox(label="π Manuscript Reference", scale=2)book_input = gr.Textbox(label="π Bible Book", scale=2)chapter_input = gr.Number(label="Chapter", precision=0, scale=1)verse_input = gr.Number(label="Verse", precision=0, scale=1)text_string_input = gr.Textbox(label="π Hebrew Verses Input String", scale=4)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)output_html = gr.HTML(elem_classes=["theater-viewport"])submit_btn.click(generate_table_code, [api_key_input, manuscript_input, book_input, chapter_input, verse_input, text_string_input], [output_html, copy_btn])copy_btn.click(fn=None, js=copy_btn_js)demo.load(js=sticky_session_and_layout_js)demo.queue().launch(server_name="0.0.0.0", server_port=7860, css=custom_css)
app.py+51-209