cstr commited on
Commit
01c58ac
Β·
verified Β·
1 Parent(s): da2dff9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -16
app.py CHANGED
@@ -1,6 +1,6 @@
1
  #!/usr/bin/env python3
2
  """
3
- Gradio interface for Ultimate Document Translator
4
  Designed for Hugging Face Spaces deployment
5
  """
6
 
@@ -213,24 +213,11 @@ def create_interface():
213
 
214
  with gr.Blocks(title="Document Translator") as demo: # REMOVED theme parameter
215
  gr.Markdown("""
216
- # 🌍 Ultimate Document Translator
217
 
218
  Translate Word documents while preserving formatting, footnotes, and styling.
219
-
220
- **Features:**
221
- - Multiple neural translation backends (NLLB, Madlad, Opus-MT, WMT21)
222
- - Word-level alignment for format preservation
223
- - Support for footnotes, tables, headers/footers
224
- - Optional LLM enhancement (OpenAI/Anthropic)
225
-
226
- **Recommended Settings:**
227
- - Mode: Hybrid (best quality)
228
- - Backend: NLLB (fastest, good quality)
229
- - Size: 600M (good balance)
230
  """)
231
 
232
- gr.Markdown(f"### System Status\n```\n{SETUP_STATUS}\n```")
233
-
234
  with gr.Row():
235
  with gr.Column(scale=1):
236
  gr.Markdown("### πŸ“€ Input")
@@ -312,7 +299,20 @@ def create_interface():
312
  interactive=False
313
  )
314
 
 
 
315
  gr.Markdown("""
 
 
 
 
 
 
 
 
 
 
 
316
  ### πŸ“– Tips
317
 
318
  - **For best quality**: Use "Hybrid" mode with NLLB backend
@@ -329,7 +329,6 @@ def create_interface():
329
  - LLM modes are slower and require API access
330
  """)
331
 
332
- # FIXED: Proper event handler without gr.State
333
  def handle_translate(input_f, src_lang_name, tgt_lang_name, mode, nmt, nllb_sz, algn, llm):
334
  src_code = languages.get(src_lang_name, "en")
335
  tgt_code = languages.get(tgt_lang_name, "de")
 
1
  #!/usr/bin/env python3
2
  """
3
+ Gradio interface for Document Translator
4
  Designed for Hugging Face Spaces deployment
5
  """
6
 
 
213
 
214
  with gr.Blocks(title="Document Translator") as demo: # REMOVED theme parameter
215
  gr.Markdown("""
216
+ # 🌍 Document Translator
217
 
218
  Translate Word documents while preserving formatting, footnotes, and styling.
 
 
 
 
 
 
 
 
 
 
 
219
  """)
220
 
 
 
221
  with gr.Row():
222
  with gr.Column(scale=1):
223
  gr.Markdown("### πŸ“€ Input")
 
299
  interactive=False
300
  )
301
 
302
+ gr.Markdown(f"### System Status\n```\n{SETUP_STATUS}\n```")
303
+
304
  gr.Markdown("""
305
+ **Features:**
306
+ - Multiple neural translation backends (NLLB, Madlad, Opus-MT, WMT21)
307
+ - Word-level alignment for format preservation
308
+ - Support for footnotes, tables, headers/footers
309
+ - Optional LLM enhancement (OpenAI/Anthropic)
310
+
311
+ **Recommended Settings:**
312
+ - Mode: Hybrid (best quality)
313
+ - Backend: NLLB (fastest, good quality)
314
+ - Size: 600M (good balance)
315
+
316
  ### πŸ“– Tips
317
 
318
  - **For best quality**: Use "Hybrid" mode with NLLB backend
 
329
  - LLM modes are slower and require API access
330
  """)
331
 
 
332
  def handle_translate(input_f, src_lang_name, tgt_lang_name, mode, nmt, nllb_sz, algn, llm):
333
  src_code = languages.get(src_lang_name, "en")
334
  tgt_code = languages.get(tgt_lang_name, "de")