Spaces:
Running
Running
Update app.py
Browse files8 unmodified lines910111213141516171819202122232492 unmodified lines117118119120121122123193 unmodified lines3173183193203213223238 unmodified linesfrom docx.oxml import parse_xml, OxmlElementfrom docx.oxml.ns import nsdecls, qn# Classic reliable legacy library version that matches your environment perfectlyimport google.generativeai as generative_ai# ---------------------------------------------------------------------------# 1. LIVE LINGUISTIC PIPELINE (RESTORED CLEAN SDK CALL)# ---------------------------------------------------------------------------def process_live_ai_request(word, api_key):"""Queries the stable Gemini 1.5 Flash model directly using the classicgenerativeai SDK configuration setup that successfully generated your tables."""clean_key = api_key.strip() if api_key else ""if not clean_key:92 unmodified linescell_top.width = Inches(col_widths[col_idx])tcPr_top = cell_top._tc.get_or_add_tcPr()borders_top = parse_xml(f'<w:tcBorders {nsdecls("w")}><w:top w:val="single" w:sz="4" w:color="B7B7B7"/><w:left w:val="single" w:sz="4" w:color="B7B7B7"/><w:bottom w:val="single" w:sz="4" w:color="B7B7B7"/><w:right w:val="single" w:sz="4" w:color="B7B7B7"/></w:tcBorders>')# Word cell margins locked down precisely to your 0.069 inches padding benchmarkpadding_top = parse_xml(f'<w:tcMar {nsdecls("w")}><w:top w:w="99" w:type="dxa"/><w:left w:w="99" w:type="dxa"/><w:bottom w:w="99" w:type="dxa"/><w:right w:w="99" w:type="dxa"/></w:tcMar>')tcPr_top.append(borders_top)tcPr_top.append(padding_top)193 unmodified lineswith gr.Row():with gr.Column(scale=2):# FIX: Locked font contrast parameters inline directly onto the paragraph block text nodesgr.HTML('''<div class="api-guide-box"><p style="color: #2D3748 !important; font-family: Arial, sans-serif !important; font-size: 11pt !important; margin: 0 !important; padding: 0 !important; line-height: 1.4 !important;">8 unmodified lines910111213141516171819202122232492 unmodified lines117118119120121122123193 unmodified lines3173183193203213223238 unmodified linesfrom docx.oxml import parse_xml, OxmlElementfrom docx.oxml.ns import nsdecls, qn# Standard classic library that natively maps your stable model choice seamlesslyimport google.generativeai as generative_ai# ---------------------------------------------------------------------------# 1. CORE API LINGUISTIC PIPELINE (STABLE LEGACY WORKSPACE ROUTING)# ---------------------------------------------------------------------------def process_live_ai_request(word, api_key):"""Queries the stable Gemini 1.5 Flash model directly using the classicgenerativeai SDK configuration setup to completely bypass 404 mismatches."""clean_key = api_key.strip() if api_key else ""if not clean_key:92 unmodified linescell_top.width = Inches(col_widths[col_idx])tcPr_top = cell_top._tc.get_or_add_tcPr()borders_top = parse_xml(f'<w:tcBorders {nsdecls("w")}><w:top w:val="single" w:sz="4" w:color="B7B7B7"/><w:left w:val="single" w:sz="4" w:color="B7B7B7"/><w:bottom w:val="single" w:sz="4" w:color="B7B7B7"/><w:right w:val="single" w:sz="4" w:color="B7B7B7"/></w:tcBorders>')# Cell margin cell padding locked tightly to your clean 0.069 inches benchmark configpadding_top = parse_xml(f'<w:tcMar {nsdecls("w")}><w:top w:w="99" w:type="dxa"/><w:left w:w="99" w:type="dxa"/><w:bottom w:w="99" w:type="dxa"/><w:right w:w="99" w:type="dxa"/></w:tcMar>')tcPr_top.append(borders_top)tcPr_top.append(padding_top)193 unmodified lineswith gr.Row():with gr.Column(scale=2):# FIX: Injected inline styling color attributes directly into the HTML tag properties to enforce clear graygr.HTML('''<div class="api-guide-box"><p style="color: #2D3748 !important; font-family: Arial, sans-serif !important; font-size: 11pt !important; margin: 0 !important; padding: 0 !important; line-height: 1.4 !important;">
app.py+5-5