fluidapex Claude commited on
Commit
bff5d75
·
1 Parent(s): 5f0ca99

Update interface for dialogue translation testing

Browse files

- Add 4 example dialogue sections (4-6 lines each)
- Update UI to focus on dialogue translation use case
- Increase text area size to 8 lines for better visibility
- Update README with dialogue translation features
- Include generic conversation examples for testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (2) hide show
  1. README.md +9 -3
  2. app.py +14 -11
README.md CHANGED
@@ -12,8 +12,14 @@ models:
12
  short_description: Japanese to English translation using ALMA-7B-J model
13
  ---
14
 
15
- # ALMA-7B-J Translation Demo
16
 
17
- This Space demonstrates Japanese to English translation using the ALMA-7B-J model.
18
 
19
- ALMA-7B-J is a LLaMA-2-7B based translation model trained specifically for Japanese-English translation tasks.
 
 
 
 
 
 
 
12
  short_description: Japanese to English translation using ALMA-7B-J model
13
  ---
14
 
15
+ # ALMA-7B-J Dialogue Translation Demo
16
 
17
+ This Space demonstrates Japanese to English translation using the ALMA-7B-J model, optimized for translating dialogue sections from Japanese animated films.
18
 
19
+ **Features:**
20
+ - Translate 4-6 line dialogue sections
21
+ - Preserves character names and conversation structure
22
+ - Powered by ALMA-7B-J (LLaMA-2-7B based model)
23
+
24
+ **Usage:**
25
+ Paste your Japanese dialogue text and click Translate, or try one of the example conversations to see the translation quality.
app.py CHANGED
@@ -51,33 +51,36 @@ def translate_japanese_to_english(japanese_text):
51
  # Create Gradio interface
52
  with gr.Blocks(title="ALMA-7B-J Translation") as demo:
53
  gr.Markdown("""
54
- # 🇯🇵 ALMA-7B-J: Japanese to English Translation
55
 
56
- Enter Japanese text below and get an English translation using the ALMA-7B-J model.
 
 
 
57
  """)
58
 
59
  with gr.Row():
60
  with gr.Column():
61
  japanese_input = gr.Textbox(
62
- label="Japanese Input",
63
- placeholder="日本語のテキストを入力してください...",
64
- lines=5
65
  )
66
  translate_btn = gr.Button("Translate", variant="primary")
67
 
68
  with gr.Column():
69
  english_output = gr.Textbox(
70
  label="English Translation",
71
- lines=5
72
  )
73
 
74
- # Example inputs
75
  gr.Examples(
76
  examples=[
77
- ["こちは、元気ですか?"],
78
- ["今日天気ですね。"],
79
- ["私は日本語を勉強していま。"],
80
- ["東京日本首都。"],
81
  ],
82
  inputs=japanese_input,
83
  )
 
51
  # Create Gradio interface
52
  with gr.Blocks(title="ALMA-7B-J Translation") as demo:
53
  gr.Markdown("""
54
+ # 🎬 ALMA-7B-J: Japanese Dialogue Translation
55
 
56
+ Test Japanese to English translation using the ALMA-7B-J model.
57
+ Perfect for translating dialogue sections from Japanese animated films (4-6 lines).
58
+
59
+ Paste your Japanese dialogue below or try one of the example conversations!
60
  """)
61
 
62
  with gr.Row():
63
  with gr.Column():
64
  japanese_input = gr.Textbox(
65
+ label="Japanese Dialogue",
66
+ placeholder="Paste your Japanese dialogue here (4-6 lines)...\nExample:\nキャラクター1: セリフ\nキャラクター2: セリフ",
67
+ lines=8
68
  )
69
  translate_btn = gr.Button("Translate", variant="primary")
70
 
71
  with gr.Column():
72
  english_output = gr.Textbox(
73
  label="English Translation",
74
+ lines=8
75
  )
76
 
77
+ # Example dialogue sections for testing (generic examples, not from specific films)
78
  gr.Examples(
79
  examples=[
80
+ ["キャラクターA: おはよう!今日はどこに行くの?\nキャラクターB: 学校に行くよ。一緒に行ない\nキャラクターA: うん、行こう!\nキャラクターB: じゃあ、準備しよう。"],
81
+ ["少年: ここ本当に美し場所だね。\n少女: そうね。いつも来たかったの。\n少年: 一緒に来られて良かった。\n少女: 私も嬉しいわ。"],
82
+ ["主人公: 諦めたらそこで終わりだ。\n友人: でも、もう無理だよ。\n主人公: 無理じゃなだチャンスはある\n友人: 分かった。最後までやってみよう。"],
83
+ ["キャラクターA: これ何?\nキャラクターB: 不思議な石だよ。\nキャラクターA: どこで見つけた?\nキャラクターB: 森の奥見つけたんだ\nキャラクターA: 本当に神秘的ね。"],
84
  ],
85
  inputs=japanese_input,
86
  )