updates for dropdown list
Browse files
app.py
CHANGED
|
@@ -142,13 +142,15 @@ with gr.Blocks(theme=myTheme) as demo:
|
|
| 142 |
toolkit_select = gr.Dropdown(["OPUS", "NLLB"], label="Select Translation Model")
|
| 143 |
lang_select = gr.Radio(["English", "Chinese"], label="Select Desired Language")
|
| 144 |
result = gr.Textbox(label="Translated Result")
|
| 145 |
-
|
| 146 |
toolkit_select.select(on_select)
|
| 147 |
-
trans_btn.click(fn=opus_trans, inputs=[article, lang_select], outputs=result)
|
| 148 |
if toolkit_select.select(on_select) == "OPUS":
|
| 149 |
print(" chosen OPUS")
|
|
|
|
| 150 |
trans_btn.click(fn=opus_trans, inputs=[article, lang_select], outputs=result)
|
| 151 |
elif toolkit_select.select(on_select) == "NLLB":
|
| 152 |
print(" chosen NLLB")
|
|
|
|
| 153 |
trans_btn.click(fn=nllb_trans, inputs=[article, lang_select], outputs=result)
|
| 154 |
demo.launch()
|
|
|
|
| 142 |
toolkit_select = gr.Dropdown(["OPUS", "NLLB"], label="Select Translation Model")
|
| 143 |
lang_select = gr.Radio(["English", "Chinese"], label="Select Desired Language")
|
| 144 |
result = gr.Textbox(label="Translated Result")
|
| 145 |
+
|
| 146 |
toolkit_select.select(on_select)
|
| 147 |
+
# trans_btn.click(fn=opus_trans, inputs=[article, lang_select], outputs=result)
|
| 148 |
if toolkit_select.select(on_select) == "OPUS":
|
| 149 |
print(" chosen OPUS")
|
| 150 |
+
trans_btn = gr.Button("Translate")
|
| 151 |
trans_btn.click(fn=opus_trans, inputs=[article, lang_select], outputs=result)
|
| 152 |
elif toolkit_select.select(on_select) == "NLLB":
|
| 153 |
print(" chosen NLLB")
|
| 154 |
+
trans_btn = gr.Button("Translate")
|
| 155 |
trans_btn.click(fn=nllb_trans, inputs=[article, lang_select], outputs=result)
|
| 156 |
demo.launch()
|