TwentyNine
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,13 +5,13 @@ tokenizer = AutoTokenizer.from_pretrained("TwentyNine/byt5-ain-kana-latin-conver
|
|
5 |
model = AutoModelForSeq2SeqLM.from_pretrained("TwentyNine/byt5-ain-kana-latin-converter-v1")
|
6 |
|
7 |
def transcribe(input_str):
|
8 |
-
input_enc = tokenizer.encode(input_str, return_tensors='pt')
|
9 |
output_enc = model.generate(input_enc, max_length=256)
|
10 |
return tokenizer.decode(output_enc[0], skip_special_tokens=True)
|
11 |
|
12 |
gradio_app = gr.Interface(
|
13 |
transcribe,
|
14 |
-
inputs=gr.Textbox(label='Input (kana)', value='', placeholder='', info='Ainu text written in Japanese katakana (input).', interactive=True, autofocus=True),
|
15 |
outputs=gr.Textbox(label='Output (alphabet)', info='Ainu text written in the Latin alphabet (output).'),
|
16 |
title="BYT5 Ainu Kana-Latin Converter (V1)",
|
17 |
)
|
|
|
5 |
model = AutoModelForSeq2SeqLM.from_pretrained("TwentyNine/byt5-ain-kana-latin-converter-v1")
|
6 |
|
7 |
def transcribe(input_str):
|
8 |
+
input_enc = tokenizer.encode(input_str.strip(), return_tensors='pt')
|
9 |
output_enc = model.generate(input_enc, max_length=256)
|
10 |
return tokenizer.decode(output_enc[0], skip_special_tokens=True)
|
11 |
|
12 |
gradio_app = gr.Interface(
|
13 |
transcribe,
|
14 |
+
inputs=gr.Textbox(label='Input (kana)', value='トゥイマ ヒ ワ エエㇰ ワ ヒオーイオイ。ピㇼカノ ヌカㇻ ヤン!', placeholder='トゥイマ ヒ ワ エエㇰ ワ ヒオーイオイ。ピㇼカノ ヌカㇻ ヤン!', info='Ainu text written in Japanese katakana (input).', interactive=True, autofocus=True),
|
15 |
outputs=gr.Textbox(label='Output (alphabet)', info='Ainu text written in the Latin alphabet (output).'),
|
16 |
title="BYT5 Ainu Kana-Latin Converter (V1)",
|
17 |
)
|