Fix Google Translate escaping (#3827)

---------

Co-authored-by: oobabooga <112222186+oobabooga@users.noreply.github.com>
This commit is contained in:
Lu Guanghua 2023-09-16 21:18:06 +08:00 committed by GitHub
parent 7c9664ed35
commit cd534ba46e
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,5 @@
import html
import gradio as gr import gradio as gr
from deep_translator import GoogleTranslator from deep_translator import GoogleTranslator
@ -27,7 +29,8 @@ def output_modifier(string):
if not params['activate']: if not params['activate']:
return string return string
return GoogleTranslator(source='en', target=params['language string']).translate(string) translated_str = GoogleTranslator(source='en', target=params['language string']).translate(html.unescape(string))
return html.escape(translated_str)
def bot_prefix_modifier(string): def bot_prefix_modifier(string):