Spaces:
Running
Running
UI tweaks
Browse files
app.py
CHANGED
|
@@ -257,8 +257,12 @@ def cancel_current_job(job_id):
|
|
| 257 |
with gr.Blocks(title="📚 Bilingual Book Builder") as demo:
|
| 258 |
storage_hours = JOB_MAX_AGE_SECONDS // 3600
|
| 259 |
gr.Markdown(f"""
|
|
|
|
|
|
|
| 260 |
Upload a **source** (original) EPUB and a **target** (translation) EPUB to create a side‑by‑side bilingual book.
|
|
|
|
| 261 |
Processing may take hours – you can close this page and return later.
|
|
|
|
| 262 |
When ready, the bilingual EPUB will be stored for **{storage_hours} hours**.
|
| 263 |
""")
|
| 264 |
|
|
@@ -267,21 +271,20 @@ with gr.Blocks(title="📚 Bilingual Book Builder") as demo:
|
|
| 267 |
job_state = gr.BrowserState("")
|
| 268 |
job_id_hidden = gr.Textbox(visible=False)
|
| 269 |
|
| 270 |
-
with gr.
|
| 271 |
-
with gr.
|
| 272 |
source_file = gr.File(label="Source EPUB", file_types=[".epub"], value=None)
|
| 273 |
target_file = gr.File(label="Target EPUB", file_types=[".epub"], value=None)
|
| 274 |
-
with gr.
|
| 275 |
source_lang = gr.Textbox(label="Source language, e.g. en, ru, de", placeholder="Auto‑detect")
|
| 276 |
target_lang = gr.Textbox(label="Target language, e.g. en, ru, de", placeholder="Auto‑detect")
|
| 277 |
-
|
| 278 |
-
with gr.Row():
|
| 279 |
process_btn = gr.Button("🚀 Build Bilingual EPUB", variant="primary")
|
| 280 |
cancel_btn = gr.Button("❌ Cancel", variant="stop", visible=False)
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
process_btn.click(
|
| 286 |
fn=submit_job,
|
| 287 |
inputs=[source_file, target_file, source_lang, target_lang],
|
|
@@ -335,7 +338,6 @@ with gr.Blocks(title="📚 Bilingual Book Builder") as demo:
|
|
| 335 |
],
|
| 336 |
)
|
| 337 |
|
| 338 |
-
refresh_btn = gr.Button("🔄 Check Status")
|
| 339 |
refresh_btn.click(
|
| 340 |
fn=load_job,
|
| 341 |
inputs=job_state,
|
|
|
|
| 257 |
with gr.Blocks(title="📚 Bilingual Book Builder") as demo:
|
| 258 |
storage_hours = JOB_MAX_AGE_SECONDS // 3600
|
| 259 |
gr.Markdown(f"""
|
| 260 |
+
# Bilingual Book Builder
|
| 261 |
+
|
| 262 |
Upload a **source** (original) EPUB and a **target** (translation) EPUB to create a side‑by‑side bilingual book.
|
| 263 |
+
|
| 264 |
Processing may take hours – you can close this page and return later.
|
| 265 |
+
|
| 266 |
When ready, the bilingual EPUB will be stored for **{storage_hours} hours**.
|
| 267 |
""")
|
| 268 |
|
|
|
|
| 271 |
job_state = gr.BrowserState("")
|
| 272 |
job_id_hidden = gr.Textbox(visible=False)
|
| 273 |
|
| 274 |
+
with gr.Column():
|
| 275 |
+
with gr.Row():
|
| 276 |
source_file = gr.File(label="Source EPUB", file_types=[".epub"], value=None)
|
| 277 |
target_file = gr.File(label="Target EPUB", file_types=[".epub"], value=None)
|
| 278 |
+
with gr.Row():
|
| 279 |
source_lang = gr.Textbox(label="Source language, e.g. en, ru, de", placeholder="Auto‑detect")
|
| 280 |
target_lang = gr.Textbox(label="Target language, e.g. en, ru, de", placeholder="Auto‑detect")
|
| 281 |
+
with gr.Column():
|
|
|
|
| 282 |
process_btn = gr.Button("🚀 Build Bilingual EPUB", variant="primary")
|
| 283 |
cancel_btn = gr.Button("❌ Cancel", variant="stop", visible=False)
|
| 284 |
+
refresh_btn = gr.Button("🔄 Check Status")
|
| 285 |
+
status_msg = gr.Markdown("")
|
| 286 |
+
output_file = gr.File(label="Download Bilingual EPUB", interactive=False, visible=False)
|
| 287 |
+
|
| 288 |
process_btn.click(
|
| 289 |
fn=submit_job,
|
| 290 |
inputs=[source_file, target_file, source_lang, target_lang],
|
|
|
|
| 338 |
],
|
| 339 |
)
|
| 340 |
|
|
|
|
| 341 |
refresh_btn.click(
|
| 342 |
fn=load_job,
|
| 343 |
inputs=job_state,
|