jisukim8873 commited on
Commit
5a31d97
1 Parent(s): 598e486
Files changed (1) hide show
  1. app.py +17 -24
app.py CHANGED
@@ -77,35 +77,28 @@ def conversion(source, text):
77
 
78
  return generated_text
79
 
80
- title = 'KoTAN Translator & Speech-style converter'
81
  lang = ['English','Korean']
82
  style = ['formal', 'informal', 'android', 'azae', 'chat', 'choding', 'emoticon', 'enfp', \
83
  'gentle', 'halbae', 'halmae', 'joongding', 'king', 'naruto', 'seonbi', 'sosim', 'translator']
84
 
85
- with gr.Blocks() as demo:
86
- gr.Markdown("KoTAN: Korean Translation and Augmentation with fine-tuned NLLB. You can exercise translation tasks, and speech-style conversion. \
87
- If you want to download as pip package, please visit our github. (https://github.com/KoJLabs/KoTAN)")
88
 
89
- # with gr.Tab("Translation"):
90
- # translator_app = gr.Interface(
91
- # fn=translate,
92
- # inputs=[gr.inputs.Dropdown(choices=lang, label='Source Language'), gr.inputs.Dropdown(choices=lang, label='Target Language'), gr.inputs.Textbox(lines=5, label='Text to Translate')],
93
- # outputs=[gr.outputs.Textbox(label='Translated Text')],
94
- # title=title,
95
- # # description = 'KoTAN: Korean Translation and Augmentation with fine-tuned NLLB. If you want to download as pip package, please visit our github. (https://github.com/KoJLabs/KoTAN)',
96
- # # article='Jisu, Kim. Juhwan, Lee',
97
- # enable_queue=True,
98
- # )
99
 
100
- with gr.Tab("Speech-style conversion"):
101
- translator_app = gr.Interface(
102
- fn=conversion,
103
- inputs=[gr.inputs.Dropdown(choices=style, label='Speech Style'), gr.inputs.Textbox(lines=5, label='Text to style conversion')],
104
- outputs=[gr.outputs.Textbox(label='Converted Text')],
105
- title=title,
106
- # description = 'KoTAN: Korean Translation and Augmentation with fine-tuned NLLB. If you want to download as pip package, please visit our github. (https://github.com/KoJLabs/KoTAN)',
107
- # article='Jisu, Kim. Juhwan, Lee',
108
- enable_queue=True,
109
- )
110
 
111
  demo.launch()
 
77
 
78
  return generated_text
79
 
80
+ title = 'KoTAN Translator & Speech-style converter. If you want to download as pip package, please visit our github. (https://github.com/KoJLabs/KoTAN)'
81
  lang = ['English','Korean']
82
  style = ['formal', 'informal', 'android', 'azae', 'chat', 'choding', 'emoticon', 'enfp', \
83
  'gentle', 'halbae', 'halmae', 'joongding', 'king', 'naruto', 'seonbi', 'sosim', 'translator']
84
 
 
 
 
85
 
86
+ translator_app = gr.Interface(
87
+ fn=translate,
88
+ inputs=[gr.inputs.Dropdown(choices=lang, label='Source Language'), gr.inputs.Dropdown(choices=lang, label='Target Language'), gr.inputs.Textbox(lines=5, label='Text to Translate')],
89
+ outputs=[gr.outputs.Textbox(label='Translated Text')],
90
+ title=title,
91
+ enable_queue=True,
92
+ )
 
 
 
93
 
94
+ conversion_app = gr.Interface(
95
+ fn=conversion,
96
+ inputs=[gr.inputs.Dropdown(choices=style, label='Speech Style'), gr.inputs.Textbox(lines=5, label='Text to style conversion')],
97
+ outputs=[gr.outputs.Textbox(label='Converted Text')],
98
+ title=title,
99
+ enable_queue=True,
100
+ )
101
+
102
+ demo = gr.TabbedInterface([translator_app, conversion_app], ["Translator", "Speech Style converter"])
 
103
 
104
  demo.launch()