Spaces:
Runtime error
Runtime error
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>
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
#
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
""")
|
| 58 |
|
| 59 |
with gr.Row():
|
| 60 |
with gr.Column():
|
| 61 |
japanese_input = gr.Textbox(
|
| 62 |
-
label="Japanese
|
| 63 |
-
placeholder="
|
| 64 |
-
lines=
|
| 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=
|
| 72 |
)
|
| 73 |
|
| 74 |
-
# Example
|
| 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 |
)
|