aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui_components.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ui_components.py')
-rw-r--r--modules/ui_components.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/ui_components.py b/modules/ui_components.py
index 46324425..989cc87b 100644
--- a/modules/ui_components.py
+++ b/modules/ui_components.py
@@ -1,3 +1,5 @@
+import html
+
import gradio as gr
@@ -47,3 +49,8 @@ class FormColorPicker(gr.ColorPicker, gr.components.FormComponent):
def get_block_name(self):
return "colorpicker"
+
+
+def plaintext_to_html(text):
+ text = "<p>" + "<br>\n".join([f"{html.escape(x)}" for x in text.split('\n')]) + "</p>"
+ return text