perkan commited on
Commit
8232ee0
1 Parent(s): af519b5

[UPDATE] => changing the layout to singe input text that is then translated by the two selected models

Browse files
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -51,23 +51,18 @@ def translate_fine_tuned(text, model):
51
 
52
  # Create Gradio interface
53
  with gr.Blocks() as demo:
54
- gr.Markdown("# Translation Models")
55
-
56
  with gr.Row():
57
- with gr.Column():
58
- gr.Markdown("### Base Model")
59
- base_input = gr.Textbox(placeholder="Enter text to translate", label="Input")
60
- base_output = gr.Textbox(label="Translation")
61
- base_translate_btn = gr.Button("Translate")
62
- base_translate_btn.click(translate_base, inputs=base_input, outputs=base_output)
63
-
64
- with gr.Column():
65
- gr.Markdown("### Fine-tuned Models")
66
- fine_tuned_input = gr.Textbox(placeholder="Enter text to translate", label="Input")
67
- model_select = gr.Dropdown(choices=["S model", "M model", "L model"], label="Select Model")
68
- fine_tuned_output = gr.Textbox(label="Translation")
69
- fine_tuned_translate_btn = gr.Button("Translate")
70
- fine_tuned_translate_btn.click(translate_fine_tuned, inputs=[fine_tuned_input, model_select], outputs=fine_tuned_output)
71
 
72
  port = int(os.getenv("GRADIO_SERVER_PORT", "7861"))
73
  demo.launch(server_port=port)
 
51
 
52
  # Create Gradio interface
53
  with gr.Blocks() as demo:
54
+ gr.Markdown("# Translation Models\nTranslate text using base and fine-tuned models.")
55
+
56
  with gr.Row():
57
+ text_input = gr.Textbox(placeholder="Enter text to translate", label="Input", placeholder="If you have behaved badly, repent, make what amends you can and address yourself to the task of behaving better next time. On no account brood over your wrongdoing. Rolling in the muck is not the best way of getting clean.")
58
+ model_select = gr.Dropdown(choices=["S model", "M model", "L model"], label="Select Fine-tuned Model")
59
+ translate_btn = gr.Button("Translate")
60
+
61
+ with gr.Row():
62
+ base_output = gr.Textbox(label="Base Model Translation")
63
+ fine_tuned_output = gr.Textbox(label="Fine-tuned Model Translation")
64
+
65
+ translate_btn.click(translate_text, inputs=[text_input, model_select], outputs=[base_output, fine_tuned_output])
 
 
 
 
 
66
 
67
  port = int(os.getenv("GRADIO_SERVER_PORT", "7861"))
68
  demo.launch(server_port=port)