Spaces:
Running on CPU Upgrade

ziem-io commited on
Commit
5a001f3
·
1 Parent(s): 71c9493

Update: Texts

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -107,7 +107,9 @@ def predict(review: str):
107
  # Abort if text is not english
108
  if not review_is_eng:
109
  review = translate_en(review)
110
- html_out += "<b>Your text has been automatically translated.</b>"
 
 
111
  is_translated = True
112
 
113
  prediction_flavours = {}
@@ -133,7 +135,7 @@ def predict(review: str):
133
  "review": review,
134
  "model": MODEL_FILE,
135
  "device": device,
136
- "is_translated": is_translated,
137
  "duration": round((t_end_flavours - t_start_flavours), 3),
138
  }
139
 
@@ -175,6 +177,7 @@ with gr.Blocks(css=custom_css) as demo:
175
  placeholder="Enter whisky review",
176
  value=random_text(),
177
  )
 
178
  with gr.Row():
179
  replace_btn = gr.Button("Load Example", variant="secondary", scale=1)
180
  submit_btn = gr.Button("Submit", variant="primary", scale=1)
 
107
  # Abort if text is not english
108
  if not review_is_eng:
109
  review = translate_en(review)
110
+ html_out += f"""<b>Your text has been automatically translated:</b>
111
+ <p>{review}</p>
112
+ """
113
  is_translated = True
114
 
115
  prediction_flavours = {}
 
135
  "review": review,
136
  "model": MODEL_FILE,
137
  "device": device,
138
+ "translated": is_translated,
139
  "duration": round((t_end_flavours - t_start_flavours), 3),
140
  }
141
 
 
177
  placeholder="Enter whisky review",
178
  value=random_text(),
179
  )
180
+ gr.HTML("<div style='color: gray; font-size: 0.9em;'>Note: Non-English texts will be automatically translated.</div>")
181
  with gr.Row():
182
  replace_btn = gr.Button("Load Example", variant="secondary", scale=1)
183
  submit_btn = gr.Button("Submit", variant="primary", scale=1)