Spaces:
Running on Zero
Running on Zero
Use arithmetic-coding description and symmetric Compress/Restore layouts
Browse files
style.css
CHANGED
|
@@ -21,7 +21,7 @@ h1 { font-size: 24px !important; font-weight: 600 !important; letter-spacing: -.
|
|
| 21 |
.gradio-container textarea::placeholder { color: #8a9086 !important; }
|
| 22 |
.gradio-container textarea:focus { outline: 1px solid #466b4d !important; outline-offset: -1px; }
|
| 23 |
#ascii textarea, #decode-code textarea { font-family: ui-monospace, monospace !important; font-size: 13px !important; }
|
| 24 |
-
|
| 25 |
.action-row { align-items: center !important; gap: 18px !important; }
|
| 26 |
.action-row > div { min-width: 180px !important; }
|
| 27 |
.limit-note { font-size: 11px; color: #798172; }
|
|
|
|
| 21 |
.gradio-container textarea::placeholder { color: #8a9086 !important; }
|
| 22 |
.gradio-container textarea:focus { outline: 1px solid #466b4d !important; outline-offset: -1px; }
|
| 23 |
#ascii textarea, #decode-code textarea { font-family: ui-monospace, monospace !important; font-size: 13px !important; }
|
| 24 |
+
.result-box textarea { background: #f4f5f1 !important; }
|
| 25 |
.action-row { align-items: center !important; gap: 18px !important; }
|
| 26 |
.action-row > div { min-width: 180px !important; }
|
| 27 |
.limit-note { font-size: 11px; color: #798172; }
|
ui.py
CHANGED
|
@@ -67,7 +67,7 @@ def build_demo(compress, decompress):
|
|
| 67 |
with gr.Blocks(title='Text compressor', analytics_enabled=False) as demo:
|
| 68 |
gr.HTML('<header class="page-header"><div class="wordmark"><span class="mark">[t]</span>'
|
| 69 |
'<h1>Text compressor</h1></div><span class="model-label">Qwen 3.5 · 35B base · Q8</span>'
|
| 70 |
-
'</header><p class="intro">
|
| 71 |
with gr.Tabs(elem_id='modes'):
|
| 72 |
with gr.Tab('Compress', id='compress'):
|
| 73 |
with gr.Row(elem_classes='editor-row'):
|
|
@@ -78,7 +78,7 @@ def build_demo(compress, decompress):
|
|
| 78 |
with gr.Column(min_width=280):
|
| 79 |
encoded = gr.Textbox(label='Compressed ASCII', lines=10, max_lines=16,
|
| 80 |
placeholder='Your copyable code appears here.', interactive=False,
|
| 81 |
-
buttons=['copy'], elem_id='ascii')
|
| 82 |
with gr.Row(elem_classes='action-row'):
|
| 83 |
encode_button = gr.Button('Compress text →', variant='primary', min_width=180, scale=0)
|
| 84 |
gr.HTML('<span class="limit-note">8,192 tokens · 64 KiB max</span>', apply_default_css=False)
|
|
@@ -87,11 +87,15 @@ def build_demo(compress, decompress):
|
|
| 87 |
heatmap = gr.HTML('', elem_id='heatmap', js_on_load=TOKEN_JS, apply_default_css=False)
|
| 88 |
with gr.Tab('Restore', id='restore'):
|
| 89 |
with gr.Row(elem_classes='editor-row'):
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
decode_status = gr.Markdown(elem_id='decode-status')
|
| 96 |
decode_stats = gr.JSON(visible=False)
|
| 97 |
gr.HTML('<footer class="page-footer"><span>Lossless · Copyable ASCII</span>'
|
|
|
|
| 67 |
with gr.Blocks(title='Text compressor', analytics_enabled=False) as demo:
|
| 68 |
gr.HTML('<header class="page-header"><div class="wordmark"><span class="mark">[t]</span>'
|
| 69 |
'<h1>Text compressor</h1></div><span class="model-label">Qwen 3.5 · 35B base · Q8</span>'
|
| 70 |
+
'</header><p class="intro">Arithmetic coding for text.</p>', apply_default_css=False)
|
| 71 |
with gr.Tabs(elem_id='modes'):
|
| 72 |
with gr.Tab('Compress', id='compress'):
|
| 73 |
with gr.Row(elem_classes='editor-row'):
|
|
|
|
| 78 |
with gr.Column(min_width=280):
|
| 79 |
encoded = gr.Textbox(label='Compressed ASCII', lines=10, max_lines=16,
|
| 80 |
placeholder='Your copyable code appears here.', interactive=False,
|
| 81 |
+
buttons=['copy'], elem_id='ascii', elem_classes='result-box')
|
| 82 |
with gr.Row(elem_classes='action-row'):
|
| 83 |
encode_button = gr.Button('Compress text →', variant='primary', min_width=180, scale=0)
|
| 84 |
gr.HTML('<span class="limit-note">8,192 tokens · 64 KiB max</span>', apply_default_css=False)
|
|
|
|
| 87 |
heatmap = gr.HTML('', elem_id='heatmap', js_on_load=TOKEN_JS, apply_default_css=False)
|
| 88 |
with gr.Tab('Restore', id='restore'):
|
| 89 |
with gr.Row(elem_classes='editor-row'):
|
| 90 |
+
with gr.Column(min_width=280):
|
| 91 |
+
code_input = gr.Textbox(label='Compressed ASCII', lines=10, max_lines=16,
|
| 92 |
+
placeholder='Paste a code from this compressor…', elem_id='decode-code')
|
| 93 |
+
with gr.Column(min_width=280):
|
| 94 |
+
restored = gr.Textbox(label='Restored text', lines=10, max_lines=16, interactive=False,
|
| 95 |
+
placeholder='Your original text appears here.', buttons=['copy'],
|
| 96 |
+
elem_classes='result-box')
|
| 97 |
+
with gr.Row(elem_classes='action-row'):
|
| 98 |
+
decode_button = gr.Button('Restore text →', variant='primary', min_width=180, scale=0)
|
| 99 |
decode_status = gr.Markdown(elem_id='decode-status')
|
| 100 |
decode_stats = gr.JSON(visible=False)
|
| 101 |
gr.HTML('<footer class="page-footer"><span>Lossless · Copyable ASCII</span>'
|