davda54 commited on
Commit
001b50d
1 Parent(s): 3d7e4b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -73,10 +73,6 @@ class BatchStreamer(TextIteratorStreamer):
73
  self.on_finalized_text(printable_text, stream_end=True)
74
 
75
 
76
- def set_default_target():
77
- return "*Translating...*"
78
-
79
-
80
  def translate(source, source_language, target_language):
81
  if source_language == target_language:
82
  yield source.strip()
@@ -125,7 +121,7 @@ with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
125
  with gr.Row():
126
  with gr.Column(scale=7, variant="panel"):
127
  source_language = gr.Dropdown(
128
- LANGUAGES, value=LANGUAGES[0], show_label=False
129
  )
130
  source = gr.Textbox(
131
  label="Source text", placeholder="What do you want to translate?", show_label=False, lines=7, max_lines=100, autofocus=True
@@ -137,7 +133,7 @@ with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
137
 
138
  with gr.Column(scale=7, variant="panel"):
139
  target_language = gr.Dropdown(
140
- LANGUAGES, value=LANGUAGES[1], show_label=False
141
  )
142
  target = gr.Textbox(
143
  label="Translation", show_label=False, interactive=False, lines=7, max_lines=100
@@ -163,8 +159,6 @@ with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
163
 
164
  submit_event = source.submit(
165
  fn=update_state_after_user, inputs=None, outputs=[source, submit, source_language, target_language], queue=False
166
- ).then(
167
- fn=set_default_target, inputs=[], outputs=[target], queue=False
168
  ).then(
169
  fn=translate, inputs=[source, source_language, target_language], outputs=[target], queue=True
170
  ).then(
@@ -173,8 +167,6 @@ with gr.Blocks(theme='sudeepshouche/minimalist') as demo:
173
 
174
  submit_click_event = submit.click(
175
  fn=update_state_after_user, inputs=None, outputs=[source, submit, source_language, target_language], queue=False
176
- ).then(
177
- fn=set_default_target, inputs=[], outputs=[target], queue=False
178
  ).then(
179
  fn=translate, inputs=[source, source_language, target_language], outputs=[target], queue=True
180
  ).then(
 
73
  self.on_finalized_text(printable_text, stream_end=True)
74
 
75
 
 
 
 
 
76
  def translate(source, source_language, target_language):
77
  if source_language == target_language:
78
  yield source.strip()
 
121
  with gr.Row():
122
  with gr.Column(scale=7, variant="panel"):
123
  source_language = gr.Dropdown(
124
+ LANGUAGES, value=LANGUAGES[1], show_label=False
125
  )
126
  source = gr.Textbox(
127
  label="Source text", placeholder="What do you want to translate?", show_label=False, lines=7, max_lines=100, autofocus=True
 
133
 
134
  with gr.Column(scale=7, variant="panel"):
135
  target_language = gr.Dropdown(
136
+ LANGUAGES, value=LANGUAGES[0], show_label=False
137
  )
138
  target = gr.Textbox(
139
  label="Translation", show_label=False, interactive=False, lines=7, max_lines=100
 
159
 
160
  submit_event = source.submit(
161
  fn=update_state_after_user, inputs=None, outputs=[source, submit, source_language, target_language], queue=False
 
 
162
  ).then(
163
  fn=translate, inputs=[source, source_language, target_language], outputs=[target], queue=True
164
  ).then(
 
167
 
168
  submit_click_event = submit.click(
169
  fn=update_state_after_user, inputs=None, outputs=[source, submit, source_language, target_language], queue=False
 
 
170
  ).then(
171
  fn=translate, inputs=[source, source_language, target_language], outputs=[target], queue=True
172
  ).then(