ziem-io commited on
Commit
fa07bfe
·
1 Parent(s): 11b39af

Update: Refactor random text

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -134,7 +134,7 @@ def predict(review: str):
134
 
135
  ##################################################################################
136
 
137
- def replace_text():
138
  return random.choice(EXAMPLES)
139
 
140
  def get_device_info():
@@ -158,7 +158,7 @@ with gr.Blocks() as demo:
158
  label="Whisky Review (English only)",
159
  lines=8,
160
  placeholder="Enter whisky review",
161
- value=random.choice(EXAMPLES),
162
  )
163
  with gr.Row():
164
  replace_btn = gr.Button("Load Example", variant="secondary", scale=1)
@@ -170,6 +170,6 @@ with gr.Blocks() as demo:
170
 
171
  # Events
172
  submit_btn.click(predict, inputs=review_box, outputs=[html_out, json_out])
173
- replace_btn.click(replace_text, outputs=review_box)
174
 
175
  demo.launch()
 
134
 
135
  ##################################################################################
136
 
137
+ def random_text():
138
  return random.choice(EXAMPLES)
139
 
140
  def get_device_info():
 
158
  label="Whisky Review (English only)",
159
  lines=8,
160
  placeholder="Enter whisky review",
161
+ value=random_text(),
162
  )
163
  with gr.Row():
164
  replace_btn = gr.Button("Load Example", variant="secondary", scale=1)
 
170
 
171
  # Events
172
  submit_btn.click(predict, inputs=review_box, outputs=[html_out, json_out])
173
+ replace_btn.click(random_text, outputs=review_box)
174
 
175
  demo.launch()