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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,5 @@
import html
import gradio as gr
from deep_translator import GoogleTranslator
@ -27,7 +29,8 @@ def output_modifier(string):
if not params['activate']:
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):